comparison test/test_mailgw.py @ 599:08aae4d34622

respect encodings in non multipart messages.
author Engelbert Gruber <grubert@users.sourceforge.net>
date Tue, 05 Feb 2002 14:15:29 +0000
parents 4c3dcda799f7
children 633f2b542146
comparison
equal deleted inserted replaced
598:b55fb6d88a0d 599:08aae4d34622
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.8 2002-02-04 09:40:21 grubert Exp $ 11 # $Id: test_mailgw.py,v 1.9 2002-02-05 14:15:29 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 testEnc01(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: text/plain;
201 charset="iso-8859-1"
202 Content-Transfer-Encoding: quoted-printable
203
204 A message with encoding (encoded oe =F6)
205
206 ''')
207 handler = self.instance.MailGW(self.instance, self.db)
208 handler.main(message)
209 message_data = open(os.environ['SENDMAILDEBUG']).read()
210 self.assertEqual(message_data,
211 '''FROM: roundup-admin@fill.me.in.
212 TO: chef@bork.bork.bork, richard@test
213 Content-Type: text/plain
214 Subject: [issue1] Testing...
215 To: chef@bork.bork.bork, richard@test
216 From: mary <issue_tracker@fill.me.in.>
217 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.>
218 MIME-Version: 1.0
219 Message-Id: <followup_dummy_id>
220 In-Reply-To: <dummy_test_message_id>
221
222
223 mary <mary@test> added the comment:
224
225 A message with encoding (encoded oe ö)
226
227 ----------
228 status: unread -> chatting
229 ___________________________________________________
230 "Roundup issue tracker" <issue_tracker@fill.me.in.>
231 http://some.useful.url/issue1
232 ___________________________________________________
233 ''', 'Generated message not correct')
234
235
191 def testMultipartEnc01(self): 236 def testMultipartEnc01(self):
192 self.testNewIssue() 237 self.testNewIssue()
193 message = cStringIO.StringIO('''Content-Type: text/plain; 238 message = cStringIO.StringIO('''Content-Type: text/plain;
194 charset="iso-8859-1" 239 charset="iso-8859-1"
195 From: mary <mary@test> 240 From: mary <mary@test>
249 return unittest.TestSuite(l) 294 return unittest.TestSuite(l)
250 295
251 296
252 # 297 #
253 # $Log: not supported by cvs2svn $ 298 # $Log: not supported by cvs2svn $
299 # Revision 1.8 2002/02/04 09:40:21 grubert
300 # . add test for multipart messages with first part being encoded.
301 #
254 # Revision 1.7 2002/01/22 11:54:45 rochecompaan 302 # Revision 1.7 2002/01/22 11:54:45 rochecompaan
255 # Fixed status change in mail gateway. 303 # Fixed status change in mail gateway.
256 # 304 #
257 # Revision 1.6 2002/01/21 10:05:48 rochecompaan 305 # Revision 1.6 2002/01/21 10:05:48 rochecompaan
258 # Feature: 306 # Feature:

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