Index: postman/daemon.py
===================================================================
--- postman/daemon.py	(revision 9)
+++ postman/daemon.py	(revision 10)
@@ -91,5 +91,5 @@
            'address' not in info.keys() or \
            'members' not in info.keys() or \
-           'config' not in info.keys():
+           'configfile' not in info.keys():
             raise ValueError(info, ' does not seem to be a valid configuration')
         
@@ -99,5 +99,5 @@
 
         mailing = MailingList(info['name'], info['address'],
-                              info['members'], info['config'])        
+                              info['members'], info['configfile'])
         self.mailings[mailing.address] = mailing
         self.mailings_addresses.append(mailing.address)
Index: postman/models.py
===================================================================
--- postman/models.py	(revision 5)
+++ postman/models.py	(revision 10)
@@ -33,10 +33,15 @@
     """
 
-    def __init__(self, name, address, members={}, config={}):
+    def __init__(self, name, address, members={}, configfile=None):
+        self.configfile = configfile
+        self.storage_config = config.get_config_parameters('storage',
+                                                           configfile)
+        self.archive_config = config.get_config_parameters('archive',
+                                                           configfile)
+        self.mailing_config = config.get_config_parameters('mailing_lists',
+                                                           configfile)
         self.name = name
         self.address = address
         self.members = members
-        self.config = config
-        self._validate_config() # validate the config parameters
         
     def __repr__(self):
@@ -45,13 +50,4 @@
     def __str__(self):
         return self.address
-
-    def _validate_config(self):
-        if not 'storage' in self.config.keys():
-            self.config['storage'] = os.path.join(config.storage_path,
-                                                  'mailings/')
-        if not 'archive' in self.config.keys():
-            self.config['archive'] = config.archive_path
-        if not 'private' in self.config.keys():
-            self.config['private'] = config.private_mailing
         
     def _validate_member_object(self, member=None):
@@ -71,9 +67,9 @@
     @property
     def storage(self):
-        return Storage(os.path.join(self.config['storage'], self.address))
+        return Storage(os.path.join(self.storage_config['path'], self.address))
 
     @property
     def archive(self):
-        return Storage(os.path.join(self.config['archive'], self.address))
+        return Storage(os.path.join(self.archive_config['path'], self.address))
     
     def members_addresses(self):
@@ -109,5 +105,5 @@
         # automagically generates the dict from the instance attributes
         return {'name': self.name, 'address': self.address,
-                'members': self.members, 'config': self.config}
+                'members': self.members, 'configfile': self.configfile}
 
     def load(self):
Index: postman/mta.py
===================================================================
--- postman/mta.py	(revision 2)
+++ postman/mta.py	(revision 10)
@@ -8,5 +8,5 @@
 class Sendmail():
     
-    def __init__(self, mailing_list=None):
+    def __init__(self, mailing_list=None, configfile=None):
         if not isinstance(mailing_list, MailingList):
             raise ValueError(mailing_list, ' is not a valid mailing list')
@@ -16,6 +16,6 @@
         self.raw_email = None
         self.queue = []
-        self.archive = self.mailing_list.config.get('archive',
-                                                    config.archive_path)
+        self.archive_config = config.get_config_parameters('archive',
+                                                           configfile)
         
     def get_raw_email(self):
@@ -31,5 +31,5 @@
             # check, would be nice here
             self.get_raw_email
-        filename = os.path.join(self.archive,
+        filename = os.path.join(self.archive_config['path'],
                                 datetime.today().strftime('%Y%d%m%H%M%S%f'))
         tmpfile = file(filename, 'w')
Index: postman/tests/daemon.py
===================================================================
--- postman/tests/daemon.py	(revision 9)
+++ postman/tests/daemon.py	(revision 10)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
 
-import os, multiprocessing, xmlrpclib
+import os, multiprocessing, xmlrpclib, time
 from SimpleXMLRPCServer import SimpleXMLRPCServer
 from unittest import TestCase
@@ -18,12 +18,11 @@
     """
     def setUp(self):
-        config = {'private': False, 'archive': '/tmp/postman-tests/archive',
-                  'storage': '/tmp/postman-tests/storage'}
+        self.configfile = os.path.join(os.path.dirname(__file__), 'postman.conf')
         self.mailing_list = MailingList('test_list', 'test_list@example.com',
-                                        members={}, config=config)
+                                        members={}, configfile=self.configfile)
         self.member =  Member('test@example.com')
 
     def test___init__(self):
-        postman = Postman()
+        postman = Postman(configfile=self.configfile)
         self.assertIsInstance(postman, Postman)
         self.assertEqual(postman.mailings, {})
@@ -36,5 +35,5 @@
 
     def test_save(self):
-        postman = Postman()
+        postman = Postman(configfile=self.configfile)
         self.assertFalse(postman.save())
         postman.add_mailing_list(self.mailing_list.info())
@@ -47,5 +46,5 @@
 
     def test_load(self):
-        postman = Postman()
+        postman = Postman(configfile=self.configfile)
         self.assertFalse(postman.mailings)
         self.assertFalse(postman.mailings_addresses)
@@ -55,5 +54,5 @@
 
         # Check that another postman instance is able to load the saved data
-        postman_load = Postman()
+        postman_load = Postman(configfile=self.configfile)
         self.assertFalse(postman_load.mailings)
         self.assertFalse(postman_load.mailings_addresses)
@@ -68,5 +67,5 @@
 
     def test_clear(self):
-        postman = Postman()
+        postman = Postman(configfile=self.configfile)
         self.assertFalse(postman.clear())
         postman.add_mailing_list(self.mailing_list.info())
@@ -74,5 +73,5 @@
 
     def test_add_mailing_list(self):
-        postman = Postman()
+        postman = Postman(configfile=self.configfile)
         with self.assertRaises(TypeError):
             # test improper info values
@@ -100,5 +99,5 @@
 
     def test_add_mailing_member(self):
-        postman = Postman()
+        postman = Postman(configfile=self.configfile)
         postman.add_mailing_list(self.mailing_list.info())
         with self.assertRaises(ValueError):
@@ -133,12 +132,13 @@
     """
     def setUp(self):
-        config = {'private': False, 'archive': '/tmp/postman-tests/archive',
-                  'storage': '/tmp/postman-tests/storage'}
-        self.mailing_list = MailingList('test_xmlrpc', 'test_xmlrpc@example.com',
-                                        members={}, config=config)
+        self.configfile = os.path.join(os.path.dirname(__file__),
+                                       'postman.conf')
+        self.mailing_list = MailingList('test_xmlrpc',
+                                        'test_xmlrpc@example.com', members={},
+                                        configfile=self.configfile)
         self.member =  Member('test@example.com')
 
     def test___init__(self):
-        daemon = PostmanDaemon()
+        daemon = PostmanDaemon(self.configfile)
         self.assertIsInstance(daemon, PostmanDaemon)
         self.assertFalse(daemon.ready_to_serve)
@@ -147,5 +147,5 @@
 
     def test_create_server(self):
-        daemon = PostmanDaemon()
+        daemon = PostmanDaemon(self.configfile)
         daemon.port = 9001
         self.assertTrue(daemon.create_server())
@@ -154,10 +154,10 @@
         
     def test_add_methods(self):
-        daemon = PostmanDaemon()
+        daemon = PostmanDaemon(self.configfile)
         daemon.port = 9002
         self.assertTrue(daemon.add_methods())
         self.assertTrue(daemon.ready_to_serve)
 
-        daemon = PostmanDaemon()
+        daemon = PostmanDaemon(self.configfile)
         daemon.port = 9003        
         daemon.create_server()
@@ -166,5 +166,5 @@
         
     def test_run(self):
-        daemon = PostmanDaemon()
+        daemon = PostmanDaemon(self.configfile)
         daemon.port = 9004
         # start the daemon in another process, so we can start communicating
@@ -172,4 +172,8 @@
         p = multiprocessing.Process(target=daemon.run)
         p.start()
+
+        # Add a delay here to allow the server to be fully started before
+        # starting to send requests from the client
+        time.sleep(2)
         
         # FIXME: Hardcoded url here, should be picked from a config file        
Index: postman/tests/models.py
===================================================================
--- postman/tests/models.py	(revision 1)
+++ postman/tests/models.py	(revision 10)
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
 
+import os
 from unittest import TestCase
 from postman.models import Member, MailingList
@@ -18,8 +19,7 @@
 class TestMailingList(TestCase):
     def setUp(self):
-        config = {'private': False, 'archive': '/tmp/postman-tests/archive',
-                  'storage': '/tmp/postman-tests/storage'}
+        configfile = os.path.join(os.path.dirname(__file__), 'postman.conf')
         self.mailing_list = MailingList('test_list', 'test_list@example.com',
-                                        members={}, config=config)
+                                        members={}, configfile=configfile)
         self.member =  Member('test@example.com')
 
Index: postman/tests/mta.py
===================================================================
--- postman/tests/mta.py	(revision 5)
+++ postman/tests/mta.py	(revision 10)
@@ -6,11 +6,10 @@
 from postman.models import Member, MailingList
 
-
 class TestSendmail(TestCase):
     def setUp(self):
-        config = {'private': False, 'archive': '/tmp/postman-tests/archive',
-                  'storage': '/tmp/postman-tests/storage'}
+        self.configfile = os.path.join(os.path.dirname(__file__),
+                                       'postman.conf')
         self.mailing_list = MailingList('test_list', 'test_list@example.com',
-                                        members={}, config=config)
+                                        members={}, configfile=self.configfile)
         self.member =  Member('test@example.com')
         self.mta = Sendmail(self.mailing_list)
Index: postman/tests/postman.conf
===================================================================
--- postman/tests/postman.conf	(revision 10)
+++ postman/tests/postman.conf	(revision 10)
@@ -0,0 +1,29 @@
+#
+# postman.conf - Postman configuration file
+#
+# IMPORTANT: This config file should be used only
+# for testing purposes
+
+[xmlrpc_server]
+address = localhost
+port = 9876
+ssl = false
+logfile = /tmp/postman-tests/xmlrpc_server.log
+
+[storage]
+backend = json
+path = /tmp/postman-tests/storage
+lists_db = %(path)s/mailings.%(backend)s
+members_db = %(path)s/members.%(backend)s
+
+[archive]
+enabled = true
+backend = json
+path = /tmp/postman-tests/archives
+
+[mailing_lists]
+private = true
+
+[members]
+auto_signup = false
+allow_chpasswd = false
