1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
5 """Test cases for bounce message generation
8 from twisted.trial import unittest
9 from twisted.mail import bounce
10 import rfc822, cStringIO
12 class BounceTestCase(unittest.TestCase):
14 testcases for bounce message generation
17 def testBounceFormat(self):
18 from_, to, s = bounce.generateBounce(cStringIO.StringIO('''\
19 From: Moshe Zadka <moshez@example.com>
20 To: nonexistant@example.org
23 '''), 'moshez@example.com', 'nonexistant@example.org')
24 self.assertEqual(from_, '')
25 self.assertEqual(to, 'moshez@example.com')
26 mess = rfc822.Message(cStringIO.StringIO(s))
27 self.assertEqual(mess['To'], 'moshez@example.com')
28 self.assertEqual(mess['From'], 'postmaster@example.org')
29 self.assertEqual(mess['subject'], 'Returned Mail: see transcript for details')
31 def testBounceMIME(self):