comparison test/test_mailgw.py @ 1628:ea1afeb64b45

more pedantic rfc2822 header qp encoding
author Andrey Lebedev <kedder@users.sourceforge.net>
date Tue, 06 May 2003 21:49:20 +0000
parents fc9dafcb62e0
children 2cd528577108 cf7941a669d6
comparison
equal deleted inserted replaced
1627:e029d625c8f1 1628:ea1afeb64b45
6 # 6 #
7 # This module is distributed in the hope that it will be useful, 7 # This module is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # 10 #
11 # $Id: test_mailgw.py,v 1.45 2003-04-27 02:16:47 richard Exp $ 11 # $Id: test_mailgw.py,v 1.46 2003-05-06 21:49:20 kedder Exp $
12 12
13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
14 import rfc822 14 import rfc822
15 15
16 # Note: Should parse emails according to RFC2822 instead of performing a 16 # Note: Should parse emails according to RFC2822 instead of performing a
20 # import email 20 # import email
21 #except ImportError : 21 #except ImportError :
22 # import rfc822 as email 22 # import rfc822 as email
23 23
24 from roundup.mailgw import MailGW, Unauthorized, uidFromAddress 24 from roundup.mailgw import MailGW, Unauthorized, uidFromAddress
25 from roundup import init, instance 25 from roundup import init, instance, rfc2822
26 26
27 # TODO: make this output only enough equal lines for context, not all of 27 # TODO: make this output only enough equal lines for context, not all of
28 # them 28 # them
29 class DiffHelper: 29 class DiffHelper:
30 def compareStrings(self, s2, s1): 30 def compareStrings(self, s2, s1):
950 950
951 def testUserCreate(self): 951 def testUserCreate(self):
952 i = uidFromAddress(self.db, ('', 'user@foo.com'), 1) 952 i = uidFromAddress(self.db, ('', 'user@foo.com'), 1)
953 self.assertNotEqual(uidFromAddress(self.db, ('', 'user@bar.com'), 1), i) 953 self.assertNotEqual(uidFromAddress(self.db, ('', 'user@bar.com'), 1), i)
954 954
955 def testRFC2822(self):
956 ascii_header = "[issue243] This is a \"test\" - with 'quotation' marks"
957 unicode_header = '[issue244] \xd0\xb0\xd0\xbd\xd0\xb4\xd1\x80\xd0\xb5\xd0\xb9'
958 unicode_encoded = '=?utf-8?q?[issue244]_=D0=B0=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?='
959 self.assertEqual(rfc2822.encode_header(ascii_header), ascii_header)
960 self.assertEqual(rfc2822.encode_header(unicode_header), unicode_encoded)
961
955 def suite(): 962 def suite():
956 l = [unittest.makeSuite(MailgwTestCase), 963 l = [unittest.makeSuite(MailgwTestCase),
957 ] 964 ]
958 return unittest.TestSuite(l) 965 return unittest.TestSuite(l)
959 966

Roundup Issue Tracker: http://roundup-tracker.org/