[Zope-Checkins] CVS: Zope/lib/python/Products/MailHost/tests - testMailHost.py:1.3.6.2

Andreas Jung andreas@andreas-jung.com
Mon, 7 Jul 2003 12:12:14 -0400


Update of /cvs-repository/Zope/lib/python/Products/MailHost/tests
In directory cvs.zope.org:/tmp/cvs-serv8000/lib/python/Products/MailHost/tests

Modified Files:
      Tag: Zope-2_6-branch
	testMailHost.py 
Log Message:

     - Collector #893: Mailhost: munge_header has been broken for addresses
       containing the recipients full name


=== Zope/lib/python/Products/MailHost/tests/testMailHost.py 1.3.6.1 => 1.3.6.2 ===
--- Zope/lib/python/Products/MailHost/tests/testMailHost.py:1.3.6.1	Tue Mar  4 11:29:54 2003
+++ Zope/lib/python/Products/MailHost/tests/testMailHost.py	Mon Jul  7 12:12:08 2003
@@ -54,6 +54,26 @@
         self.failUnless(resto == ['many@example.com'])
         self.failUnless(resfrom == 'me@example.com' )
 
+    def testAddressParser( self ):
+        msg = """To: "Name, Nick" <recipient@domain.com>, "Foo Bar" <foo@domain.com>
+CC: "Web, Jack" <jack@web.com>
+From: sender@domain.com
+Subject: This is the subject
+
+This is the message body."""
+        
+        # Test Address-Parser for To & CC given in messageText
+        
+        resmsg, resto, resfrom = _mungeHeaders( msg )
+        self.failUnless(resto == ['"Name, Nick" <recipient@domain.com>','"Foo Bar" <foo@domain.com>','"Web, Jack" <jack@web.com>'])
+        self.failUnless(resfrom == 'sender@domain.com' )
+
+        # Test Address-Parser for a given mto-string
+        
+        resmsg, resto, resfrom = _mungeHeaders( msg, mto= '"Public, Joe" <pjoe@domain.com>, "Foo Bar" <foo@domain.com>')
+
+        self.failUnless(resto == ['"Public, Joe" <pjoe@domain.com>','"Foo Bar" <foo@domain.com>'])
+        self.failUnless(resfrom == 'sender@domain.com' )
 
 def test_suite():
     suite = unittest.TestSuite()