Index: postman/tests/daemon.py
===================================================================
--- postman/tests/daemon.py	(revision 6)
+++ postman/tests/daemon.py	(revision 7)
@@ -1,7 +1,9 @@
 # -*- coding: utf-8 -*-
 
-import os, xmlrpclib
+import os, multiprocessing, xmlrpclib
+from SimpleXMLRPCServer import SimpleXMLRPCServer
 from unittest import TestCase
-from postman.daemon import Postman
+
+from postman.daemon import Postman, PostmanXMLRPC, PostmanDaemon
 from postman.models import Member, MailingList
 from postman.storage import JsonStorage as Storage
@@ -126,5 +128,7 @@
     """
     postman.daemon.PostmanDaemon tests.
-    
+
+    Remember to call the .clear() method of postman after each test, so
+    the temp storage files are deleted
     """
     def setUp(self):
@@ -134,5 +138,50 @@
                                         members={}, config=config)
         self.member =  Member('test@example.com')
-        # FIXME: Hardcoded url here, should be picked from a config file
+
+    def test___init__(self):
+        daemon = PostmanDaemon()
+        self.assertIsInstance(daemon, PostmanDaemon)
+        self.assertFalse(daemon.ready_to_serve)
+        # FIXME: More tests should be added here once the configuration
+        # file feature is added        
+
+    def test_create_server(self):
+        daemon = PostmanDaemon()
+        daemon.port = 9001
+        self.assertTrue(daemon.create_server())
+        self.assertIsInstance(daemon.server, SimpleXMLRPCServer)
+        self.assertFalse(daemon.ready_to_serve)
         
-        self.link = xmlrpclib.ServerProxy('http://localhost:9000')
+    def test_add_methods(self):
+        daemon = PostmanDaemon()
+        daemon.port = 9002
+        self.assertTrue(daemon.add_methods())
+        self.assertTrue(daemon.ready_to_serve)
+
+        daemon = PostmanDaemon()
+        daemon.port = 9003        
+        daemon.create_server()
+        self.assertTrue(daemon.add_methods())
+        self.assertTrue(daemon.ready_to_serve)
+        
+    def test_run(self):
+        daemon = PostmanDaemon()
+        daemon.port = 9004
+        # start the daemon in another process, so we can start communicating
+        # with itjobs = []
+        p = multiprocessing.Process(target=daemon.run)
+        p.start()
+        
+        # FIXME: Hardcoded url here, should be picked from a config file        
+        client = xmlrpclib.ServerProxy('http://localhost:9004')
+
+        # Check that we can perform an XMLRPC call and that the list of
+        # available public methods contains the list of methods we have
+        # defined in our base XMLRPC class
+        set_class_methods = set(PostmanXMLRPC()._listMethods())
+        set_xmlrpc_methods = set(client.system.listMethods())
+        self.assertTrue(set_class_methods.issubset(set_xmlrpc_methods))
+        
+        # Stop the server
+        p.terminate()
+        
