Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 4407:f6a2bfd351ee
force tests checking text output to work in the "C" locale
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 09 Aug 2010 04:43:50 +0000 |
| parents | 863ec554525c |
| children | 579802067547 |
comparison
equal
deleted
inserted
replaced
| 4406:3a0395583de5 | 4407:f6a2bfd351ee |
|---|---|
| 19 | 19 |
| 20 if not os.environ.has_key('SENDMAILDEBUG'): | 20 if not os.environ.has_key('SENDMAILDEBUG'): |
| 21 os.environ['SENDMAILDEBUG'] = 'mail-test.log' | 21 os.environ['SENDMAILDEBUG'] = 'mail-test.log' |
| 22 SENDMAILDEBUG = os.environ['SENDMAILDEBUG'] | 22 SENDMAILDEBUG = os.environ['SENDMAILDEBUG'] |
| 23 | 23 |
| 24 from roundup import mailgw, i18n, roundupdb | |
| 24 from roundup.mailgw import MailGW, Unauthorized, uidFromAddress, \ | 25 from roundup.mailgw import MailGW, Unauthorized, uidFromAddress, \ |
| 25 parseContent, IgnoreLoop, IgnoreBulk, MailUsageError, MailUsageHelp | 26 parseContent, IgnoreLoop, IgnoreBulk, MailUsageError, MailUsageHelp |
| 26 from roundup import init, instance, password, rfc2822, __version__ | 27 from roundup import init, instance, password, rfc2822, __version__ |
| 27 from roundup.anypy.sets_ import set | 28 from roundup.anypy.sets_ import set |
| 28 | 29 |
| 117 | 118 |
| 118 class MailgwTestCase(unittest.TestCase, DiffHelper): | 119 class MailgwTestCase(unittest.TestCase, DiffHelper): |
| 119 count = 0 | 120 count = 0 |
| 120 schema = 'classic' | 121 schema = 'classic' |
| 121 def setUp(self): | 122 def setUp(self): |
| 123 self.old_translate_ = mailgw._ | |
| 124 roundupdb._ = mailgw._ = i18n.get_translation(language='C').gettext | |
| 122 MailgwTestCase.count = MailgwTestCase.count + 1 | 125 MailgwTestCase.count = MailgwTestCase.count + 1 |
| 123 | 126 |
| 124 # and open the database / "instance" | 127 # and open the database / "instance" |
| 125 self.db = memorydb.create('admin') | 128 self.db = memorydb.create('admin') |
| 126 self.instance = Tracker() | 129 self.instance = Tracker() |
| 139 alternate_addresses='jondoe@test.test\njohn.doe@test.test') | 142 alternate_addresses='jondoe@test.test\njohn.doe@test.test') |
| 140 self.rgg_id = self.db.user.create(username='rgg', | 143 self.rgg_id = self.db.user.create(username='rgg', |
| 141 address='rgg@test.test', roles='User') | 144 address='rgg@test.test', roles='User') |
| 142 | 145 |
| 143 def tearDown(self): | 146 def tearDown(self): |
| 147 roundupdb._ = mailgw._ = self.old_translate_ | |
| 144 if os.path.exists(SENDMAILDEBUG): | 148 if os.path.exists(SENDMAILDEBUG): |
| 145 os.remove(SENDMAILDEBUG) | 149 os.remove(SENDMAILDEBUG) |
| 146 self.db.close() | 150 self.db.close() |
| 147 | 151 |
| 148 def _create_mailgw(self, message): | 152 def _create_mailgw(self, message): |
