Premiere version : mise en route du suivi.
[auf_roundup.git] / test / test_rfc2822.py
1 from roundup.rfc2822 import decode_header, encode_header
2
3 import unittest, time
4
5 class RFC2822TestCase(unittest.TestCase):
6 def testDecode(self):
7 src = 'Re: [it_issue3] '\
8 '=?ISO-8859-1?Q?Ren=E9s_[resp=3Dg=2Cstatus=3D?= '\
9 '=?ISO-8859-1?Q?feedback]?='
10 result = 'Re: [it_issue3] Ren\xc3\xa9s [resp=g,status=feedback]'
11 self.assertEqual(decode_header(src), result)
12
13 src = 'Re: [it_issue3]'\
14 ' =?ISO-8859-1?Q?Ren=E9s_[resp=3Dg=2Cstatus=3D?=' \
15 ' =?ISO-8859-1?Q?feedback]?='
16 result = 'Re: [it_issue3] Ren\xc3\xa9s [resp=g,status=feedback]'
17 self.assertEqual(decode_header(src), result)
18
19 def testEncode(self):
20 src = 'Re: [it_issue3] Ren\xc3\xa9s [status=feedback]'
21 result = '=?utf-8?q?Re:_[it=5Fissue3]_Ren=C3=A9s_[status=3Dfeedback]?='
22 self.assertEqual(encode_header(src), result)
23
24 src = 'Was machen\xc3\xbc und Fragezeichen?'
25 result = '=?utf-8?q?Was_machen=C3=BC_und_Fragezeichen=3F?='
26 self.assertEqual(encode_header(src), result)
27
28 def test_suite():
29 suite = unittest.TestSuite()
30 suite.addTest(unittest.makeSuite(RFC2822TestCase))
31 return suite