Index: postman/tests/__init__.py
===================================================================
--- postman/tests/__init__.py	(revision 11)
+++ postman/tests/__init__.py	(revision 15)
@@ -12,4 +12,4 @@
 
 from models import *
-from mta import *
+# from mta import *
 from daemon import *
Index: postman/tests/mta.py
===================================================================
--- postman/tests/mta.py	(revision 10)
+++ postman/tests/mta.py	(revision 15)
@@ -1,11 +1,19 @@
 # -*- coding: utf-8 -*-
 
-import os, sys
+import os, sys, multiprocessing, time
 from unittest import TestCase
-from postman.mta import Sendmail
+from postman.mta import MTAClient
+from postman.daemon import PostmanDaemon
 from postman.models import Member, MailingList
 
-class TestSendmail(TestCase):
+
+class TestMTAClient(TestCase):
+    """
+    FIXME: These are dummy tests, they cover almost nothing from the
+    real postman mta client (yet)
+    """
     def setUp(self):
+        self.mta_configfile = os.path.join(os.path.dirname(__file__),
+                                           'postman-mta.conf')
         self.configfile = os.path.join(os.path.dirname(__file__),
                                        'postman.conf')
@@ -13,5 +21,4 @@
                                         members={}, configfile=self.configfile)
         self.member =  Member('test@example.com')
-        self.mta = Sendmail(self.mailing_list)
         self.raw_email_file = os.path.join(os.path.dirname(__file__),
                                            'sample_raw_email.txt')
@@ -19,24 +26,62 @@
         self.raw_email = tmp_to_read.read()
         tmp_to_read.close()
-        
+
     def test___init__(self):
+        # in order to start mta client instances, we need to have a postman
+        # daemon running on the background
+        # This should be added to the setUp() method, but then it would be
+        # more difficult to terminate the process after all the methods
+        # were called
+        daemon = PostmanDaemon(self.configfile)
+        daemon.port = 9100
+        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(1)
+
         with self.assertRaises(ValueError):
-            mta = Sendmail('test_list@example.com')
-            mta = Sendmail(self.member)
-            mta = Sendmail(None)
-        mta = Sendmail(self.mailing_list)
-        self.assertTrue(isinstance(mta, Sendmail))
-        self.assertEqual(mta.mailing_list, self.mailing_list)
+            mta = MTAClient(self.mailing_list, self.mta_configfile)
+            mta = MTAClient(self.member, self.mta_configfile)
+            mta = MTAClient(None, self.mta_configfile)
+        mta = MTAClient(self.mailing_list.address, self.mta_configfile)
+        self.assertTrue(isinstance(mta, MTAClient))
+        self.assertEqual(mta.address, self.mailing_list.address)
         self.assertEqual(mta.suscriptors, self.mailing_list.members_addresses)
         self.assertEqual(mta.reply_to, self.mailing_list.address)
 
+        p.terminate()
+
     def test_get_raw_email(self):
+        # in order to start mta client instances, we need to have a postman
+        # daemon running on the background
+        # This should be added to the setUp() method, but then it would be
+        # more difficult to terminate the process after all the methods
+        # were called
+        daemon = PostmanDaemon(self.configfile)
+        daemon.port = 9100
+        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(1)
+
+        mta = MTAClient(self.mailing_list.address, self.mta_configfile)
+
         sys_stdin = sys.stdin
         sys.stdin = open(self.raw_email_file, 'r')
-        self.assertEqual(self.mta.get_raw_email(),
+        self.assertEqual(mta.get_raw_email(),
                          self.raw_email)
         sys.stdin.close()
         with self.assertRaises(IOError):
-            self.mta.get_raw_email()
+            mta.get_raw_email()
+
+        tmp_file= open(self.raw_email_file('r'))
+        raw_data = tmp_file.read()
+        tmp_file.close()
+        self.assertEqual(mta.get_raw_email(raw_data),
+                         self.raw_email)
+
+        p.terminate()
 
     #def save_raw_email(self):
Index: postman/tests/postman-mta.conf
===================================================================
--- postman/tests/postman-mta.conf	(revision 15)
+++ postman/tests/postman-mta.conf	(revision 15)
@@ -0,0 +1,13 @@
+#
+# postman-mta.conf - Postman MTA client configuration file
+#
+
+[server]
+address = localhost
+port = 9100 # this port is hardcoded in tests/mta.py
+uri = http://%(address)s:%(port)s
+ssl = false
+
+[archive]
+persistent = true
+path = /tmp/postman-tests/mta/archive
