Mercurial > p > roundup > code
comparison test/test_mailer.py @ 4520:182d8c41a3aa
Fix mailer encoding test:
- better name to be able to match it when running single test on the
command line
- use iso8859-1 instead of latin1, python2.7 will convert latin1 to
iso8859-1 which made the test fail
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Fri, 15 Jul 2011 10:03:37 +0000 |
| parents | 94ee533613ac |
| children | 364c54991861 |
comparison
equal
deleted
inserted
replaced
| 4519:bb667c81f848 | 4520:182d8c41a3aa |
|---|---|
| 2 import unittest | 2 import unittest |
| 3 | 3 |
| 4 from roundup import mailer | 4 from roundup import mailer |
| 5 | 5 |
| 6 class EncodingTestCase(unittest.TestCase): | 6 class EncodingTestCase(unittest.TestCase): |
| 7 def test(self): | 7 def testEncoding(self): |
| 8 a = lambda n, a, c, o: self.assertEquals(mailer.nice_sender_header(n, | 8 a = lambda n, a, c, o: self.assertEquals(mailer.nice_sender_header(n, |
| 9 a, c), o) | 9 a, c), o) |
| 10 a('ascii', 'ascii@test.com', 'latin1', 'ascii <ascii@test.com>') | 10 a('ascii', 'ascii@test.com', 'iso8859-1', 'ascii <ascii@test.com>') |
| 11 a(u'café', 'ascii@test.com', 'latin1', | 11 a(u'café', 'ascii@test.com', 'iso8859-1', |
| 12 '=?latin1?q?caf=E9?= <ascii@test.com>') | 12 '=?iso8859-1?q?caf=E9?= <ascii@test.com>') |
| 13 a('as"ii', 'ascii@test.com', 'latin1', '"as\\"ii" <ascii@test.com>') | 13 a('as"ii', 'ascii@test.com', 'iso8859-1', '"as\\"ii" <ascii@test.com>') |
| 14 | 14 |
| 15 def test_suite(): | 15 def test_suite(): |
| 16 suite = unittest.TestSuite() | 16 suite = unittest.TestSuite() |
| 17 suite.addTest(unittest.makeSuite(EncodingTestCase)) | 17 suite.addTest(unittest.makeSuite(EncodingTestCase)) |
| 18 return suite | 18 return suite |
