~certify-web-dev/twisted/certify-trunk

« back to all changes in this revision

Viewing changes to twisted/mail/test/test_bounce.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-17 14:52:35 UTC
  • mfrom: (1.1.5 upstream) (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20070117145235-btmig6qfmqfen0om
Tags: 2.5.0-0ubuntu1
New upstream version, compatible with python2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2001-2004 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.assertEquals(from_, '')
 
25
        self.assertEquals(to, 'moshez@example.com')
 
26
        mess = rfc822.Message(cStringIO.StringIO(s))
 
27
        self.assertEquals(mess['To'], 'moshez@example.com')
 
28
        self.assertEquals(mess['From'], 'postmaster@example.org')
 
29
        self.assertEquals(mess['subject'], 'Returned Mail: see transcript for details')
 
30
 
 
31
    def testBounceMIME(self):
 
32
        pass