Initial import to Tizen
[profile/ivi/python-twisted.git] / twisted / mail / test / test_bounce.py
1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4
5 """Test cases for bounce message generation
6 """
7
8 from twisted.trial import unittest
9 from twisted.mail import bounce
10 import rfc822, cStringIO
11
12 class BounceTestCase(unittest.TestCase):
13     """
14     testcases for bounce message generation
15     """
16
17     def testBounceFormat(self):
18         from_, to, s = bounce.generateBounce(cStringIO.StringIO('''\
19 From: Moshe Zadka <moshez@example.com>
20 To: nonexistant@example.org
21 Subject: test
22
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')
30
31     def testBounceMIME(self):
32         pass