Changeset 3384 in products
- Timestamp:
- Mar 28, 2012 1:54:01 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Products.MailHost/trunk/src/Products/MailHost/tests/testMailHost.py
r3356 r3384 27 27 self.sent = '' 28 28 def _send(self, mfrom, mto, messageText, immediate=False): 29 self.mfrom = mfrom 30 self.mto = mto 29 31 self.sent = messageText 30 32 self.immediate = immediate … … 445 447 # We need to make sure we didn't mutate the message we were passed 446 448 self.failIfEqual(out.as_string(), msg.as_string()) 447 self.failUnlessEqual(out['From'], 'Foo Bar <foo@domain.com>') 449 self.failUnlessEqual(out['From'], 450 '=?utf-8?q?Jos=C3=A9_Andr=C3=A9s?= <jose@example.com>') 448 451 self.failUnlessEqual(msg['From'], 449 452 '=?utf-8?q?Jos=C3=A9_Andr=C3=A9s?= <jose@example.com>') … … 638 641 self.assertEqual(mailhost.sent, msg) 639 642 643 def testSMTPMailFromHeaderSetup(self): 644 msg = message_from_string("""\ 645 From: =?utf-8?q?Jos=C3=A9_Andr=C3=A9s?= <jose@example.com> 646 To: =?utf-8?q?Ferran_Adri=C3=A0?= <ferran@example.com> 647 Subject: =?utf-8?q?=C2=BFEsferificaci=C3=B3n=3F?= 648 Date: Sun, 27 Aug 2006 17:00:00 +0200 649 Content-Type: text/html; charset="utf-8" 650 Content-Transfer-Encoding: base64 651 MIME-Version: 1.1 652 653 wqFVbiB0cnVjbyA8c3Ryb25nPmZhbnTDoXN0aWNvPC9zdHJvbmc+IQ=3D=3D 654 """) 655 mailhost = self._makeOne('MailHost') 656 mailhost.send(msg, mfrom='Foo Bar <foo@domain.com>') 657 out = message_from_string(mailhost.sent) 658 659 # We need to check if the 'From' header in message that we passed 660 # haven't changed. 661 self.failUnlessEqual(out['From'], msg['From']) 662 663 # We need to make sure that proper 'SMTP MAIL FROM' header was send. 664 self.failUnlessEqual(mailhost.mfrom, 'Foo Bar <foo@domain.com>') 665 666 # If 'From' header is missing in the message 667 # it should be added with 'MAIL FROM' SMTP Envelope header value. 668 del msg['From'] 669 mailhost.send(msg, mfrom='Foo Bar <foo@domain.com>') 670 out = message_from_string(mailhost.sent) 671 self.failUnlessEqual(out['From'], 'Foo Bar <foo@domain.com>') 672 640 673 641 674 def test_suite():
Note: See TracChangeset
for help on using the changeset viewer.