comparison test/test_mailgw.py @ 595:4c3dcda799f7

add test for multipart messages with first part being encoded.
author Engelbert Gruber <grubert@users.sourceforge.net>
date Mon, 04 Feb 2002 09:40:21 +0000
parents 2998d683e2cf
children 08aae4d34622
comparison
equal deleted inserted replaced
594:82555a1429d0 595:4c3dcda799f7
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.7 2002-01-22 11:54:45 rochecompaan Exp $ 11 # $Id: test_mailgw.py,v 1.8 2002-02-04 09:40:21 grubert 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
186 "Roundup issue tracker" <issue_tracker@fill.me.in.> 186 "Roundup issue tracker" <issue_tracker@fill.me.in.>
187 http://some.useful.url/issue1 187 http://some.useful.url/issue1
188 ___________________________________________________ 188 ___________________________________________________
189 ''', 'Generated message not correct') 189 ''', 'Generated message not correct')
190 190
191 def testMultipartEnc01(self):
192 self.testNewIssue()
193 message = cStringIO.StringIO('''Content-Type: text/plain;
194 charset="iso-8859-1"
195 From: mary <mary@test>
196 To: issue_tracker@fill.me.in.
197 Message-Id: <followup_dummy_id>
198 In-Reply-To: <dummy_test_message_id>
199 Subject: [issue1] Testing...
200 Content-Type: multipart/mixed;
201 boundary="----_=_NextPart_000_01"
202
203 This message is in MIME format. Since your mail reader does not understand
204 this format, some or all of this message may not be legible.
205
206 ------_=_NextPart_000_01
207 Content-Type: text/plain;
208 charset="iso-8859-1"
209 Content-Transfer-Encoding: quoted-printable
210
211 A message with first part encoded (encoded oe =F6)
212
213 ''')
214 handler = self.instance.MailGW(self.instance, self.db)
215 handler.main(message)
216 message_data = open(os.environ['SENDMAILDEBUG']).read()
217 self.assertEqual(message_data,
218 '''FROM: roundup-admin@fill.me.in.
219 TO: chef@bork.bork.bork, richard@test
220 Content-Type: text/plain
221 Subject: [issue1] Testing...
222 To: chef@bork.bork.bork, richard@test
223 From: mary <issue_tracker@fill.me.in.>
224 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.>
225 MIME-Version: 1.0
226 Message-Id: <followup_dummy_id>
227 In-Reply-To: <dummy_test_message_id>
228
229
230 mary <mary@test> added the comment:
231
232 A message with first part encoded (encoded oe ö)
233
234 ----------
235 status: unread -> chatting
236 ___________________________________________________
237 "Roundup issue tracker" <issue_tracker@fill.me.in.>
238 http://some.useful.url/issue1
239 ___________________________________________________
240 ''', 'Generated message not correct')
241
191 class ExtMailgwTestCase(MailgwTestCase): 242 class ExtMailgwTestCase(MailgwTestCase):
192 schema = 'extended' 243 schema = 'extended'
193 244
194 def suite(): 245 def suite():
195 l = [unittest.makeSuite(MailgwTestCase, 'test'), 246 l = [unittest.makeSuite(MailgwTestCase, 'test'),
198 return unittest.TestSuite(l) 249 return unittest.TestSuite(l)
199 250
200 251
201 # 252 #
202 # $Log: not supported by cvs2svn $ 253 # $Log: not supported by cvs2svn $
254 # Revision 1.7 2002/01/22 11:54:45 rochecompaan
255 # Fixed status change in mail gateway.
256 #
203 # Revision 1.6 2002/01/21 10:05:48 rochecompaan 257 # Revision 1.6 2002/01/21 10:05:48 rochecompaan
204 # Feature: 258 # Feature:
205 # . the mail gateway now responds with an error message when invalid 259 # . the mail gateway now responds with an error message when invalid
206 # values for arguments are specified for link or multilink properties 260 # values for arguments are specified for link or multilink properties
207 # . modified unit test to check nosy and assignedto when specified as 261 # . modified unit test to check nosy and assignedto when specified as

Roundup Issue Tracker: http://roundup-tracker.org/