Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 3367:a23863a95326
handle missing Subject lines better [SF#1198729]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 24 Jun 2005 06:47:44 +0000 |
| parents | cfe7d8cb9794 |
| children | 07c696890f55 |
comparison
equal
deleted
inserted
replaced
| 3365:e2d65f6c8d83 | 3367:a23863a95326 |
|---|---|
| 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.74 2005-02-14 05:54:41 richard Exp $ | 11 # $Id: test_mailgw.py,v 1.75 2005-06-24 06:47:44 richard Exp $ |
| 12 | 12 |
| 13 # TODO: test bcc | 13 # TODO: test bcc |
| 14 | 14 |
| 15 import unittest, tempfile, os, shutil, errno, imp, sys, difflib, rfc822 | 15 import unittest, tempfile, os, shutil, errno, imp, sys, difflib, rfc822 |
| 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 | 24 parseContent, IgnoreLoop, IgnoreBulk, MailUsageError |
| 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): |
| 1018 Subject: Re: [issue] Out of office AutoReply: Back next week | 1018 Subject: Re: [issue] Out of office AutoReply: Back next week |
| 1019 | 1019 |
| 1020 Hi, I'm back in the office next week | 1020 Hi, I'm back in the office next week |
| 1021 ''') | 1021 ''') |
| 1022 | 1022 |
| 1023 def testNoSubject(self): | |
| 1024 self.assertRaises(MailUsageError, self._handle_mail, | |
| 1025 '''Content-Type: text/plain; | |
| 1026 charset="iso-8859-1" | |
| 1027 From: Chef <chef@bork.bork.bork> | |
| 1028 To: issue_tracker@your.tracker.email.domain.example | |
| 1029 Cc: richard@test | |
| 1030 Reply-To: chef@bork.bork.bork | |
| 1031 Message-Id: <dummy_test_message_id> | |
| 1032 | |
| 1033 ''') | |
| 1034 | |
| 1023 def test_suite(): | 1035 def test_suite(): |
| 1024 suite = unittest.TestSuite() | 1036 suite = unittest.TestSuite() |
| 1025 suite.addTest(unittest.makeSuite(MailgwTestCase)) | 1037 suite.addTest(unittest.makeSuite(MailgwTestCase)) |
| 1026 return suite | 1038 return suite |
| 1027 | 1039 |
