Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 3812:27b589d3b79d
Added simple test for 'Subject: help' functionality.
| author | Erik Forsberg <forsberg@users.sourceforge.net> |
|---|---|
| date | Sun, 21 Jan 2007 18:14:35 +0000 |
| parents | ccd55dc53410 |
| children | 23470ece29de |
comparison
equal
deleted
inserted
replaced
| 3811:ccd55dc53410 | 3812:27b589d3b79d |
|---|---|
| 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.82 2007-01-21 18:08:31 forsberg Exp $ | 11 # $Id: test_mailgw.py,v 1.83 2007-01-21 18:14:35 forsberg Exp $ |
| 12 | 12 |
| 13 # TODO: test bcc | 13 # TODO: test bcc |
| 14 | 14 |
| 15 import unittest, tempfile, os, shutil, errno, imp, sys, difflib, rfc822, time | 15 import unittest, tempfile, os, shutil, errno, imp, sys, difflib, rfc822, time |
| 16 | 16 |
| 19 if not os.environ.has_key('SENDMAILDEBUG'): | 19 if not os.environ.has_key('SENDMAILDEBUG'): |
| 20 os.environ['SENDMAILDEBUG'] = 'mail-test.log' | 20 os.environ['SENDMAILDEBUG'] = 'mail-test.log' |
| 21 SENDMAILDEBUG = os.environ['SENDMAILDEBUG'] | 21 SENDMAILDEBUG = os.environ['SENDMAILDEBUG'] |
| 22 | 22 |
| 23 from roundup.mailgw import MailGW, Unauthorized, uidFromAddress, \ | 23 from roundup.mailgw import MailGW, Unauthorized, uidFromAddress, \ |
| 24 parseContent, IgnoreLoop, IgnoreBulk, MailUsageError | 24 parseContent, IgnoreLoop, IgnoreBulk, MailUsageError, MailUsageHelp |
| 25 from roundup import init, instance, password, rfc2822, __version__ | 25 from roundup import init, instance, password, rfc2822, __version__ |
| 26 | 26 |
| 27 import db_test_base | 27 import db_test_base |
| 28 | 28 |
| 29 class Message(rfc822.Message): | 29 class Message(rfc822.Message): |
| 1311 ''') | 1311 ''') |
| 1312 | 1312 |
| 1313 self.assertEqual(nodeid, nodeid2) | 1313 self.assertEqual(nodeid, nodeid2) |
| 1314 self.assertEqual(nodeid, nodeid3) | 1314 self.assertEqual(nodeid, nodeid3) |
| 1315 | 1315 |
| 1316 def testHelpSubject(self): | |
| 1317 message = '''Content-Type: text/plain; | |
| 1318 charset="iso-8859-1" | |
| 1319 From: Chef <chef@bork.bork.bork> | |
| 1320 To: issue_tracker@your.tracker.email.domain.example | |
| 1321 Message-Id: <dummy_test_message_id2> | |
| 1322 In-Reply-To: <dummy_test_message_id> | |
| 1323 Subject: hElp | |
| 1324 | |
| 1325 | |
| 1326 ''' | |
| 1327 self.assertRaises(MailUsageHelp, self._handle_mail, message) | |
| 1328 | |
| 1329 | |
| 1316 def test_suite(): | 1330 def test_suite(): |
| 1317 suite = unittest.TestSuite() | 1331 suite = unittest.TestSuite() |
| 1318 suite.addTest(unittest.makeSuite(MailgwTestCase)) | 1332 suite.addTest(unittest.makeSuite(MailgwTestCase)) |
| 1319 return suite | 1333 return suite |
| 1320 | 1334 |
