Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 537:ad6dbc21a570
[SF#503340] creating issue with [asignedto=p.ohly]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 15 Jan 2002 00:12:40 +0000 |
| parents | a69dc91643e9 |
| children | d7b9751f8927 |
comparison
equal
deleted
inserted
replaced
| 536:8298fea69bc3 | 537:ad6dbc21a570 |
|---|---|
| 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.4 2002-01-14 07:12:15 richard Exp $ | 11 # $Id: test_mailgw.py,v 1.5 2002-01-15 00:12:40 richard Exp $ |
| 12 | 12 |
| 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys | 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys |
| 14 | 14 |
| 15 from roundup.mailgw import MailGW | 15 from roundup.mailgw import MailGW |
| 16 from roundup import init, instance | 16 from roundup import init, instance |
| 65 message = cStringIO.StringIO('''Content-Type: text/plain; | 65 message = cStringIO.StringIO('''Content-Type: text/plain; |
| 66 charset="iso-8859-1" | 66 charset="iso-8859-1" |
| 67 From: Chef <chef@bork.bork.bork | 67 From: Chef <chef@bork.bork.bork |
| 68 To: issue_tracker@fill.me.in. | 68 To: issue_tracker@fill.me.in. |
| 69 Message-Id: <dummy_test_message_id> | 69 Message-Id: <dummy_test_message_id> |
| 70 Subject: [issue] Testing... | 70 Subject: [issue] Testing... [assignedto=richard] |
| 71 | 71 |
| 72 This is a test submission of a new issue. | 72 This is a test submission of a new issue. |
| 73 ''') | 73 ''') |
| 74 handler = self.instance.MailGW(self.instance, self.db) | 74 handler = self.instance.MailGW(self.instance, self.db) |
| 75 # TODO: fix the damn config - this is apalling | 75 # TODO: fix the damn config - this is apalling |
| 76 self.db.config.MESSAGES_TO_AUTHOR = 'yes' | 76 self.db.config.MESSAGES_TO_AUTHOR = 'yes' |
| 77 handler.main(message) | |
| 78 | |
| 79 self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(), | |
| 80 '''FROM: roundup-admin@fill.me.in. | |
| 81 TO: chef@bork.bork.bork, richard@test | |
| 82 Content-Type: text/plain | |
| 83 Subject: [issue1] Testing... | |
| 84 To: chef@bork.bork.bork, richard@test | |
| 85 From: Chef <issue_tracker@fill.me.in.> | |
| 86 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> | |
| 87 MIME-Version: 1.0 | |
| 88 Message-Id: <dummy_test_message_id> | |
| 89 | |
| 90 | |
| 91 New submission from Chef <chef@bork.bork.bork>: | |
| 92 | |
| 93 This is a test submission of a new issue. | |
| 94 | |
| 95 | |
| 96 ---------- | |
| 97 assignedto: richard | |
| 98 messages: 1 | |
| 99 nosy: Chef, richard | |
| 100 status: unread | |
| 101 title: Testing... | |
| 102 ___________________________________________________ | |
| 103 "Roundup issue tracker" <issue_tracker@fill.me.in.> | |
| 104 http://some.useful.url/issue1 | |
| 105 ___________________________________________________ | |
| 106 ''') | |
| 107 | |
| 108 def testFollowup(self): | |
| 109 self.testNewIssue() | |
| 110 message = cStringIO.StringIO('''Content-Type: text/plain; | |
| 111 charset="iso-8859-1" | |
| 112 From: richard <richard@test> | |
| 113 To: issue_tracker@fill.me.in. | |
| 114 Message-Id: <followup_dummy_id> | |
| 115 In-Reply-To: <dummy_test_message_id> | |
| 116 Subject: [issue1] Testing... | |
| 117 | |
| 118 This is a followup | |
| 119 ''') | |
| 120 handler = self.instance.MailGW(self.instance, self.db) | |
| 77 handler.main(message) | 121 handler.main(message) |
| 78 | 122 |
| 79 self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(), | 123 self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(), |
| 80 '''FROM: roundup-admin@fill.me.in. | 124 '''FROM: roundup-admin@fill.me.in. |
| 81 TO: chef@bork.bork.bork | 125 TO: chef@bork.bork.bork |
| 82 Content-Type: text/plain | 126 Content-Type: text/plain |
| 83 Subject: [issue1] Testing... | 127 Subject: [issue1] Testing... |
| 84 To: chef@bork.bork.bork | 128 To: chef@bork.bork.bork |
| 85 From: Chef <issue_tracker@fill.me.in.> | |
| 86 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> | |
| 87 MIME-Version: 1.0 | |
| 88 Message-Id: <dummy_test_message_id> | |
| 89 | |
| 90 | |
| 91 New submission from Chef <chef@bork.bork.bork>: | |
| 92 | |
| 93 This is a test submission of a new issue. | |
| 94 | |
| 95 ___________________________________________________ | |
| 96 "Roundup issue tracker" <issue_tracker@fill.me.in.> | |
| 97 http://some.useful.url/issue1 | |
| 98 ___________________________________________________ | |
| 99 ''', 'Generated message not correct') | |
| 100 | |
| 101 def testFollowup(self): | |
| 102 self.testNewIssue() | |
| 103 message = cStringIO.StringIO('''Content-Type: text/plain; | |
| 104 charset="iso-8859-1" | |
| 105 From: richard <richard@test> | |
| 106 To: issue_tracker@fill.me.in. | |
| 107 Message-Id: <followup_dummy_id> | |
| 108 In-Reply-To: <dummy_test_message_id> | |
| 109 Subject: [issue1] Testing... | |
| 110 | |
| 111 This is a followup | |
| 112 ''') | |
| 113 handler = self.instance.MailGW(self.instance, self.db) | |
| 114 # TODO: fix the damn config - this is apalling | |
| 115 handler.main(message) | |
| 116 | |
| 117 self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(), | |
| 118 '''FROM: roundup-admin@fill.me.in. | |
| 119 TO: chef@bork.bork.bork | |
| 120 Content-Type: text/plain | |
| 121 Subject: [issue1] Testing... | |
| 122 To: chef@bork.bork.bork | |
| 123 From: richard <issue_tracker@fill.me.in.> | 129 From: richard <issue_tracker@fill.me.in.> |
| 124 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> | 130 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> |
| 125 MIME-Version: 1.0 | 131 MIME-Version: 1.0 |
| 126 Message-Id: <followup_dummy_id> | 132 Message-Id: <followup_dummy_id> |
| 127 In-Reply-To: <dummy_test_message_id> | 133 In-Reply-To: <dummy_test_message_id> |
| 148 Subject: [issue1] Testing... | 154 Subject: [issue1] Testing... |
| 149 | 155 |
| 150 This is a second followup | 156 This is a second followup |
| 151 ''') | 157 ''') |
| 152 handler = self.instance.MailGW(self.instance, self.db) | 158 handler = self.instance.MailGW(self.instance, self.db) |
| 153 # TODO: fix the damn config - this is apalling | |
| 154 handler.main(message) | 159 handler.main(message) |
| 155 self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(), | 160 self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(), |
| 156 '''FROM: roundup-admin@fill.me.in. | 161 '''FROM: roundup-admin@fill.me.in. |
| 157 TO: chef@bork.bork.bork, richard@test | 162 TO: chef@bork.bork.bork, richard@test |
| 158 Content-Type: text/plain | 163 Content-Type: text/plain |
| 178 class ExtMailgwTestCase(MailgwTestCase): | 183 class ExtMailgwTestCase(MailgwTestCase): |
| 179 schema = 'extended' | 184 schema = 'extended' |
| 180 | 185 |
| 181 def suite(): | 186 def suite(): |
| 182 l = [unittest.makeSuite(MailgwTestCase, 'test'), | 187 l = [unittest.makeSuite(MailgwTestCase, 'test'), |
| 183 unittest.makeSuite(ExtMailgwTestCase, 'test')] | 188 unittest.makeSuite(ExtMailgwTestCase, 'test') |
| 189 ] | |
| 184 return unittest.TestSuite(l) | 190 return unittest.TestSuite(l) |
| 185 | 191 |
| 186 | 192 |
| 187 # | 193 # |
| 188 # $Log: not supported by cvs2svn $ | 194 # $Log: not supported by cvs2svn $ |
| 195 # Revision 1.4 2002/01/14 07:12:15 richard | |
| 196 # removed file writing from tests... | |
| 197 # | |
| 189 # Revision 1.3 2002/01/14 02:20:15 richard | 198 # Revision 1.3 2002/01/14 02:20:15 richard |
| 190 # . changed all config accesses so they access either the instance or the | 199 # . changed all config accesses so they access either the instance or the |
| 191 # config attriubute on the db. This means that all config is obtained from | 200 # config attriubute on the db. This means that all config is obtained from |
| 192 # instance_config instead of the mish-mash of classes. This will make | 201 # instance_config instead of the mish-mash of classes. This will make |
| 193 # switching to a ConfigParser setup easier too, I hope. | 202 # switching to a ConfigParser setup easier too, I hope. |
