comparison test/test_mailgw.py @ 742:b105b46f6324

'I must run unit tests before committing\n' * 100
author Richard Jones <richard@users.sourceforge.net>
date Thu, 23 May 2002 04:26:05 +0000
parents e10c37f53efd
children 938edfdeac6e
comparison
equal deleted inserted replaced
741:b48a19a88b65 742:b105b46f6324
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.18 2002-05-15 03:27:16 richard Exp $ 11 # $Id: test_mailgw.py,v 1.19 2002-05-23 04:26:05 richard Exp $
12 12
13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
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
64 try: 64 try:
65 shutil.rmtree(self.dirname) 65 shutil.rmtree(self.dirname)
66 except OSError, error: 66 except OSError, error:
67 if error.errno not in (errno.ENOENT, errno.ESRCH): raise 67 if error.errno not in (errno.ENOENT, errno.ESRCH): raise
68 # create the instance 68 # create the instance
69 init.init(self.dirname, self.schema, 'anydbm', 'sekrit') 69 init.install(self.dirname, 'classic', 'anydbm')
70 init.initialise(self.dirname, 'sekrit')
70 # check we can load the package 71 # check we can load the package
71 self.instance = instance.open(self.dirname) 72 self.instance = instance.open(self.dirname)
72 # and open the database 73 # and open the database
73 self.db = self.instance.open('sekrit') 74 self.db = self.instance.open('sekrit')
74 self.db.user.create(username='Chef', address='chef@bork.bork.bork') 75 self.db.user.create(username='Chef', address='chef@bork.bork.bork')
87 88
88 def testNewIssue(self): 89 def testNewIssue(self):
89 message = cStringIO.StringIO('''Content-Type: text/plain; 90 message = cStringIO.StringIO('''Content-Type: text/plain;
90 charset="iso-8859-1" 91 charset="iso-8859-1"
91 From: Chef <chef@bork.bork.bork 92 From: Chef <chef@bork.bork.bork
92 To: issue_tracker@fill.me.in. 93 To: issue_tracker@your.tracker.email.domain.example
93 Cc: richard@test 94 Cc: richard@test
94 Message-Id: <dummy_test_message_id> 95 Message-Id: <dummy_test_message_id>
95 Subject: [issue] Testing... 96 Subject: [issue] Testing...
96 97
97 This is a test submission of a new issue. 98 This is a test submission of a new issue.
108 def testNewIssueNosy(self): 109 def testNewIssueNosy(self):
109 self.instance.ADD_AUTHOR_TO_NOSY = 'yes' 110 self.instance.ADD_AUTHOR_TO_NOSY = 'yes'
110 message = cStringIO.StringIO('''Content-Type: text/plain; 111 message = cStringIO.StringIO('''Content-Type: text/plain;
111 charset="iso-8859-1" 112 charset="iso-8859-1"
112 From: Chef <chef@bork.bork.bork 113 From: Chef <chef@bork.bork.bork
113 To: issue_tracker@fill.me.in. 114 To: issue_tracker@your.tracker.email.domain.example
114 Cc: richard@test 115 Cc: richard@test
115 Message-Id: <dummy_test_message_id> 116 Message-Id: <dummy_test_message_id>
116 Subject: [issue] Testing... 117 Subject: [issue] Testing...
117 118
118 This is a test submission of a new issue. 119 This is a test submission of a new issue.
128 129
129 def testAlternateAddress(self): 130 def testAlternateAddress(self):
130 message = cStringIO.StringIO('''Content-Type: text/plain; 131 message = cStringIO.StringIO('''Content-Type: text/plain;
131 charset="iso-8859-1" 132 charset="iso-8859-1"
132 From: John Doe <john.doe@test> 133 From: John Doe <john.doe@test>
133 To: issue_tracker@fill.me.in. 134 To: issue_tracker@your.tracker.email.domain.example
134 Message-Id: <dummy_test_message_id> 135 Message-Id: <dummy_test_message_id>
135 Subject: [issue] Testing... 136 Subject: [issue] Testing...
136 137
137 This is a test submission of a new issue. 138 This is a test submission of a new issue.
138 ''') 139 ''')
147 148
148 def testNewIssueNoClass(self): 149 def testNewIssueNoClass(self):
149 message = cStringIO.StringIO('''Content-Type: text/plain; 150 message = cStringIO.StringIO('''Content-Type: text/plain;
150 charset="iso-8859-1" 151 charset="iso-8859-1"
151 From: Chef <chef@bork.bork.bork 152 From: Chef <chef@bork.bork.bork
152 To: issue_tracker@fill.me.in. 153 To: issue_tracker@your.tracker.email.domain.example
153 Cc: richard@test 154 Cc: richard@test
154 Message-Id: <dummy_test_message_id> 155 Message-Id: <dummy_test_message_id>
155 Subject: Testing... 156 Subject: Testing...
156 157
157 This is a test submission of a new issue. 158 This is a test submission of a new issue.
164 165
165 def testNewIssueAuthMsg(self): 166 def testNewIssueAuthMsg(self):
166 message = cStringIO.StringIO('''Content-Type: text/plain; 167 message = cStringIO.StringIO('''Content-Type: text/plain;
167 charset="iso-8859-1" 168 charset="iso-8859-1"
168 From: Chef <chef@bork.bork.bork 169 From: Chef <chef@bork.bork.bork
169 To: issue_tracker@fill.me.in. 170 To: issue_tracker@your.tracker.email.domain.example
170 Message-Id: <dummy_test_message_id> 171 Message-Id: <dummy_test_message_id>
171 Subject: [issue] Testing... [nosy=mary; assignedto=richard] 172 Subject: [issue] Testing... [nosy=mary; assignedto=richard]
172 173
173 This is a test submission of a new issue. 174 This is a test submission of a new issue.
174 ''') 175 ''')
176 # TODO: fix the damn config - this is apalling 177 # TODO: fix the damn config - this is apalling
177 self.db.config.MESSAGES_TO_AUTHOR = 'yes' 178 self.db.config.MESSAGES_TO_AUTHOR = 'yes'
178 handler.main(message) 179 handler.main(message)
179 180
180 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 181 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
181 '''FROM: roundup-admin@fill.me.in. 182 '''FROM: roundup-admin@your.tracker.email.domain.example
182 TO: chef@bork.bork.bork, mary@test, richard@test 183 TO: chef@bork.bork.bork, mary@test, richard@test
183 Content-Type: text/plain 184 Content-Type: text/plain
184 Subject: [issue1] Testing... 185 Subject: [issue1] Testing...
185 To: chef@bork.bork.bork, mary@test, richard@test 186 To: chef@bork.bork.bork, mary@test, richard@test
186 From: Chef <issue_tracker@fill.me.in.> 187 From: Chef <issue_tracker@your.tracker.email.domain.example>
187 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 188 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
188 MIME-Version: 1.0 189 MIME-Version: 1.0
189 Message-Id: <dummy_test_message_id> 190 Message-Id: <dummy_test_message_id>
190 X-Roundup-Name: Roundup issue tracker 191 X-Roundup-Name: Roundup issue tracker
191 Content-Transfer-Encoding: quoted-printable 192 Content-Transfer-Encoding: quoted-printable
192 193
200 assignedto: richard 201 assignedto: richard
201 messages: 1 202 messages: 1
202 nosy: Chef, mary, richard 203 nosy: Chef, mary, richard
203 status: unread 204 status: unread
204 title: Testing... 205 title: Testing...
205 ___________________________________________________ 206 _________________________________________________________________________
206 "Roundup issue tracker" <issue_tracker@fill.me.in.> 207 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
207 http://some.useful.url/issue1 208 http://your.tracker.url.example/issue1
208 ___________________________________________________ 209 _________________________________________________________________________
209 ''') 210 ''')
210 211
211 # BUG 212 # BUG
212 # def testMultipart(self): 213 # def testMultipart(self):
213 # '''With more than one part''' 214 # '''With more than one part'''
220 def testFollowup(self): 221 def testFollowup(self):
221 self.testNewIssue() 222 self.testNewIssue()
222 message = cStringIO.StringIO('''Content-Type: text/plain; 223 message = cStringIO.StringIO('''Content-Type: text/plain;
223 charset="iso-8859-1" 224 charset="iso-8859-1"
224 From: richard <richard@test> 225 From: richard <richard@test>
225 To: issue_tracker@fill.me.in. 226 To: issue_tracker@your.tracker.email.domain.example
226 Message-Id: <followup_dummy_id> 227 Message-Id: <followup_dummy_id>
227 In-Reply-To: <dummy_test_message_id> 228 In-Reply-To: <dummy_test_message_id>
228 Subject: [issue1] Testing... [assignedto=mary; nosy=john] 229 Subject: [issue1] Testing... [assignedto=mary; nosy=john]
229 230
230 This is a followup 231 This is a followup
231 ''') 232 ''')
232 handler = self.instance.MailGW(self.instance, self.db) 233 handler = self.instance.MailGW(self.instance, self.db)
233 handler.main(message) 234 handler.main(message)
234 235
235 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 236 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
236 '''FROM: roundup-admin@fill.me.in. 237 '''FROM: roundup-admin@your.tracker.email.domain.example
237 TO: chef@bork.bork.bork, john@test, mary@test 238 TO: chef@bork.bork.bork, john@test, mary@test
238 Content-Type: text/plain 239 Content-Type: text/plain
239 Subject: [issue1] Testing... 240 Subject: [issue1] Testing...
240 To: chef@bork.bork.bork, john@test, mary@test 241 To: chef@bork.bork.bork, john@test, mary@test
241 From: richard <issue_tracker@fill.me.in.> 242 From: richard <issue_tracker@your.tracker.email.domain.example>
242 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 243 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
243 MIME-Version: 1.0 244 MIME-Version: 1.0
244 Message-Id: <followup_dummy_id> 245 Message-Id: <followup_dummy_id>
245 In-Reply-To: <dummy_test_message_id> 246 In-Reply-To: <dummy_test_message_id>
246 X-Roundup-Name: Roundup issue tracker 247 X-Roundup-Name: Roundup issue tracker
247 Content-Transfer-Encoding: quoted-printable 248 Content-Transfer-Encoding: quoted-printable
254 255
255 ---------- 256 ----------
256 assignedto: -> mary 257 assignedto: -> mary
257 nosy: +mary, john 258 nosy: +mary, john
258 status: unread -> chatting 259 status: unread -> chatting
259 ___________________________________________________ 260 _________________________________________________________________________
260 "Roundup issue tracker" <issue_tracker@fill.me.in.> 261 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
261 http://some.useful.url/issue1 262 http://your.tracker.url.example/issue1
262 ___________________________________________________ 263 _________________________________________________________________________
263 ''') 264 ''')
264 265
265 def testFollowup2(self): 266 def testFollowup2(self):
266 self.testNewIssue() 267 self.testNewIssue()
267 message = cStringIO.StringIO('''Content-Type: text/plain; 268 message = cStringIO.StringIO('''Content-Type: text/plain;
268 charset="iso-8859-1" 269 charset="iso-8859-1"
269 From: mary <mary@test> 270 From: mary <mary@test>
270 To: issue_tracker@fill.me.in. 271 To: issue_tracker@your.tracker.email.domain.example
271 Message-Id: <followup_dummy_id> 272 Message-Id: <followup_dummy_id>
272 In-Reply-To: <dummy_test_message_id> 273 In-Reply-To: <dummy_test_message_id>
273 Subject: [issue1] Testing... 274 Subject: [issue1] Testing...
274 275
275 This is a second followup 276 This is a second followup
276 ''') 277 ''')
277 handler = self.instance.MailGW(self.instance, self.db) 278 handler = self.instance.MailGW(self.instance, self.db)
278 handler.main(message) 279 handler.main(message)
279 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 280 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
280 '''FROM: roundup-admin@fill.me.in. 281 '''FROM: roundup-admin@your.tracker.email.domain.example
281 TO: chef@bork.bork.bork, richard@test 282 TO: chef@bork.bork.bork, richard@test
282 Content-Type: text/plain 283 Content-Type: text/plain
283 Subject: [issue1] Testing... 284 Subject: [issue1] Testing...
284 To: chef@bork.bork.bork, richard@test 285 To: chef@bork.bork.bork, richard@test
285 From: mary <issue_tracker@fill.me.in.> 286 From: mary <issue_tracker@your.tracker.email.domain.example>
286 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 287 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
287 MIME-Version: 1.0 288 MIME-Version: 1.0
288 Message-Id: <followup_dummy_id> 289 Message-Id: <followup_dummy_id>
289 In-Reply-To: <dummy_test_message_id> 290 In-Reply-To: <dummy_test_message_id>
290 X-Roundup-Name: Roundup issue tracker 291 X-Roundup-Name: Roundup issue tracker
291 Content-Transfer-Encoding: quoted-printable 292 Content-Transfer-Encoding: quoted-printable
296 This is a second followup 297 This is a second followup
297 298
298 299
299 ---------- 300 ----------
300 status: unread -> chatting 301 status: unread -> chatting
301 ___________________________________________________ 302 _________________________________________________________________________
302 "Roundup issue tracker" <issue_tracker@fill.me.in.> 303 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
303 http://some.useful.url/issue1 304 http://your.tracker.url.example/issue1
304 ___________________________________________________ 305 _________________________________________________________________________
305 ''') 306 ''')
306 307
307 def testFollowupTitleMatch(self): 308 def testFollowupTitleMatch(self):
308 self.testNewIssue() 309 self.testNewIssue()
309 message = cStringIO.StringIO('''Content-Type: text/plain; 310 message = cStringIO.StringIO('''Content-Type: text/plain;
310 charset="iso-8859-1" 311 charset="iso-8859-1"
311 From: richard <richard@test> 312 From: richard <richard@test>
312 To: issue_tracker@fill.me.in. 313 To: issue_tracker@your.tracker.email.domain.example
313 Message-Id: <followup_dummy_id> 314 Message-Id: <followup_dummy_id>
314 In-Reply-To: <dummy_test_message_id> 315 In-Reply-To: <dummy_test_message_id>
315 Subject: Re: Testing... [assignedto=mary; nosy=john] 316 Subject: Re: Testing... [assignedto=mary; nosy=john]
316 317
317 This is a followup 318 This is a followup
318 ''') 319 ''')
319 handler = self.instance.MailGW(self.instance, self.db) 320 handler = self.instance.MailGW(self.instance, self.db)
320 handler.main(message) 321 handler.main(message)
321 322
322 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 323 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
323 '''FROM: roundup-admin@fill.me.in. 324 '''FROM: roundup-admin@your.tracker.email.domain.example
324 TO: chef@bork.bork.bork, john@test, mary@test 325 TO: chef@bork.bork.bork, john@test, mary@test
325 Content-Type: text/plain 326 Content-Type: text/plain
326 Subject: [issue1] Testing... 327 Subject: [issue1] Testing...
327 To: chef@bork.bork.bork, john@test, mary@test 328 To: chef@bork.bork.bork, john@test, mary@test
328 From: richard <issue_tracker@fill.me.in.> 329 From: richard <issue_tracker@your.tracker.email.domain.example>
329 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 330 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
330 MIME-Version: 1.0 331 MIME-Version: 1.0
331 Message-Id: <followup_dummy_id> 332 Message-Id: <followup_dummy_id>
332 In-Reply-To: <dummy_test_message_id> 333 In-Reply-To: <dummy_test_message_id>
333 X-Roundup-Name: Roundup issue tracker 334 X-Roundup-Name: Roundup issue tracker
334 Content-Transfer-Encoding: quoted-printable 335 Content-Transfer-Encoding: quoted-printable
341 342
342 ---------- 343 ----------
343 assignedto: -> mary 344 assignedto: -> mary
344 nosy: +mary, john 345 nosy: +mary, john
345 status: unread -> chatting 346 status: unread -> chatting
346 ___________________________________________________ 347 _________________________________________________________________________
347 "Roundup issue tracker" <issue_tracker@fill.me.in.> 348 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
348 http://some.useful.url/issue1 349 http://your.tracker.url.example/issue1
349 ___________________________________________________ 350 _________________________________________________________________________
350 ''') 351 ''')
351 352
352 def testFollowupNosyAuthor(self): 353 def testFollowupNosyAuthor(self):
353 self.testNewIssue() 354 self.testNewIssue()
354 self.instance.ADD_AUTHOR_TO_NOSY = 'yes' 355 self.instance.ADD_AUTHOR_TO_NOSY = 'yes'
355 message = cStringIO.StringIO('''Content-Type: text/plain; 356 message = cStringIO.StringIO('''Content-Type: text/plain;
356 charset="iso-8859-1" 357 charset="iso-8859-1"
357 From: john@test 358 From: john@test
358 To: issue_tracker@fill.me.in. 359 To: issue_tracker@your.tracker.email.domain.example
359 Message-Id: <followup_dummy_id> 360 Message-Id: <followup_dummy_id>
360 In-Reply-To: <dummy_test_message_id> 361 In-Reply-To: <dummy_test_message_id>
361 Subject: [issue1] Testing... 362 Subject: [issue1] Testing...
362 363
363 This is a followup 364 This is a followup
364 ''') 365 ''')
365 handler = self.instance.MailGW(self.instance, self.db) 366 handler = self.instance.MailGW(self.instance, self.db)
366 handler.main(message) 367 handler.main(message)
367 368
368 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 369 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
369 '''FROM: roundup-admin@fill.me.in. 370 '''FROM: roundup-admin@your.tracker.email.domain.example
370 TO: chef@bork.bork.bork, richard@test 371 TO: chef@bork.bork.bork, richard@test
371 Content-Type: text/plain 372 Content-Type: text/plain
372 Subject: [issue1] Testing... 373 Subject: [issue1] Testing...
373 To: chef@bork.bork.bork, richard@test 374 To: chef@bork.bork.bork, richard@test
374 From: john <issue_tracker@fill.me.in.> 375 From: john <issue_tracker@your.tracker.email.domain.example>
375 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 376 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
376 MIME-Version: 1.0 377 MIME-Version: 1.0
377 Message-Id: <followup_dummy_id> 378 Message-Id: <followup_dummy_id>
378 In-Reply-To: <dummy_test_message_id> 379 In-Reply-To: <dummy_test_message_id>
379 X-Roundup-Name: Roundup issue tracker 380 X-Roundup-Name: Roundup issue tracker
380 Content-Transfer-Encoding: quoted-printable 381 Content-Transfer-Encoding: quoted-printable
386 387
387 388
388 ---------- 389 ----------
389 nosy: +john 390 nosy: +john
390 status: unread -> chatting 391 status: unread -> chatting
391 ___________________________________________________ 392 _________________________________________________________________________
392 "Roundup issue tracker" <issue_tracker@fill.me.in.> 393 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
393 http://some.useful.url/issue1 394 http://your.tracker.url.example/issue1
394 ___________________________________________________ 395 _________________________________________________________________________
395 396
396 ''') 397 ''')
397 398
398 def testFollowupNosyRecipients(self): 399 def testFollowupNosyRecipients(self):
399 self.testNewIssue() 400 self.testNewIssue()
400 self.instance.ADD_RECIPIENTS_TO_NOSY = 'yes' 401 self.instance.ADD_RECIPIENTS_TO_NOSY = 'yes'
401 message = cStringIO.StringIO('''Content-Type: text/plain; 402 message = cStringIO.StringIO('''Content-Type: text/plain;
402 charset="iso-8859-1" 403 charset="iso-8859-1"
403 From: richard@test 404 From: richard@test
404 To: issue_tracker@fill.me.in. 405 To: issue_tracker@your.tracker.email.domain.example
405 Cc: john@test 406 Cc: john@test
406 Message-Id: <followup_dummy_id> 407 Message-Id: <followup_dummy_id>
407 In-Reply-To: <dummy_test_message_id> 408 In-Reply-To: <dummy_test_message_id>
408 Subject: [issue1] Testing... 409 Subject: [issue1] Testing...
409 410
411 ''') 412 ''')
412 handler = self.instance.MailGW(self.instance, self.db) 413 handler = self.instance.MailGW(self.instance, self.db)
413 handler.main(message) 414 handler.main(message)
414 415
415 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 416 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
416 '''FROM: roundup-admin@fill.me.in. 417 '''FROM: roundup-admin@your.tracker.email.domain.example
417 TO: chef@bork.bork.bork 418 TO: chef@bork.bork.bork
418 Content-Type: text/plain 419 Content-Type: text/plain
419 Subject: [issue1] Testing... 420 Subject: [issue1] Testing...
420 To: chef@bork.bork.bork 421 To: chef@bork.bork.bork
421 From: richard <issue_tracker@fill.me.in.> 422 From: richard <issue_tracker@your.tracker.email.domain.example>
422 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 423 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
423 MIME-Version: 1.0 424 MIME-Version: 1.0
424 Message-Id: <followup_dummy_id> 425 Message-Id: <followup_dummy_id>
425 In-Reply-To: <dummy_test_message_id> 426 In-Reply-To: <dummy_test_message_id>
426 X-Roundup-Name: Roundup issue tracker 427 X-Roundup-Name: Roundup issue tracker
427 Content-Transfer-Encoding: quoted-printable 428 Content-Transfer-Encoding: quoted-printable
433 434
434 435
435 ---------- 436 ----------
436 nosy: +john 437 nosy: +john
437 status: unread -> chatting 438 status: unread -> chatting
438 ___________________________________________________ 439 _________________________________________________________________________
439 "Roundup issue tracker" <issue_tracker@fill.me.in.> 440 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
440 http://some.useful.url/issue1 441 http://your.tracker.url.example/issue1
441 ___________________________________________________ 442 _________________________________________________________________________
442 443
443 ''') 444 ''')
444 445
445 def testFollowupNosyAuthorAndCopy(self): 446 def testFollowupNosyAuthorAndCopy(self):
446 self.testNewIssue() 447 self.testNewIssue()
447 self.instance.ADD_AUTHOR_TO_NOSY = 'yes' 448 self.instance.ADD_AUTHOR_TO_NOSY = 'yes'
448 self.db.config.MESSAGES_TO_AUTHOR = 'yes' 449 self.db.config.MESSAGES_TO_AUTHOR = 'yes'
449 message = cStringIO.StringIO('''Content-Type: text/plain; 450 message = cStringIO.StringIO('''Content-Type: text/plain;
450 charset="iso-8859-1" 451 charset="iso-8859-1"
451 From: john@test 452 From: john@test
452 To: issue_tracker@fill.me.in. 453 To: issue_tracker@your.tracker.email.domain.example
453 Message-Id: <followup_dummy_id> 454 Message-Id: <followup_dummy_id>
454 In-Reply-To: <dummy_test_message_id> 455 In-Reply-To: <dummy_test_message_id>
455 Subject: [issue1] Testing... 456 Subject: [issue1] Testing...
456 457
457 This is a followup 458 This is a followup
458 ''') 459 ''')
459 handler = self.instance.MailGW(self.instance, self.db) 460 handler = self.instance.MailGW(self.instance, self.db)
460 handler.main(message) 461 handler.main(message)
461 462
462 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 463 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
463 '''FROM: roundup-admin@fill.me.in. 464 '''FROM: roundup-admin@your.tracker.email.domain.example
464 TO: chef@bork.bork.bork, john@test, richard@test 465 TO: chef@bork.bork.bork, john@test, richard@test
465 Content-Type: text/plain 466 Content-Type: text/plain
466 Subject: [issue1] Testing... 467 Subject: [issue1] Testing...
467 To: chef@bork.bork.bork, john@test, richard@test 468 To: chef@bork.bork.bork, john@test, richard@test
468 From: john <issue_tracker@fill.me.in.> 469 From: john <issue_tracker@your.tracker.email.domain.example>
469 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 470 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
470 MIME-Version: 1.0 471 MIME-Version: 1.0
471 Message-Id: <followup_dummy_id> 472 Message-Id: <followup_dummy_id>
472 In-Reply-To: <dummy_test_message_id> 473 In-Reply-To: <dummy_test_message_id>
473 X-Roundup-Name: Roundup issue tracker 474 X-Roundup-Name: Roundup issue tracker
474 Content-Transfer-Encoding: quoted-printable 475 Content-Transfer-Encoding: quoted-printable
480 481
481 482
482 ---------- 483 ----------
483 nosy: +john 484 nosy: +john
484 status: unread -> chatting 485 status: unread -> chatting
485 ___________________________________________________ 486 _________________________________________________________________________
486 "Roundup issue tracker" <issue_tracker@fill.me.in.> 487 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
487 http://some.useful.url/issue1 488 http://your.tracker.url.example/issue1
488 ___________________________________________________ 489 _________________________________________________________________________
489 490
490 ''') 491 ''')
491 492
492 def testFollowupNoNosyAuthor(self): 493 def testFollowupNoNosyAuthor(self):
493 self.testNewIssue() 494 self.testNewIssue()
494 self.instance.ADD_AUTHOR_TO_NOSY = 'no' 495 self.instance.ADD_AUTHOR_TO_NOSY = 'no'
495 message = cStringIO.StringIO('''Content-Type: text/plain; 496 message = cStringIO.StringIO('''Content-Type: text/plain;
496 charset="iso-8859-1" 497 charset="iso-8859-1"
497 From: john@test 498 From: john@test
498 To: issue_tracker@fill.me.in. 499 To: issue_tracker@your.tracker.email.domain.example
499 Message-Id: <followup_dummy_id> 500 Message-Id: <followup_dummy_id>
500 In-Reply-To: <dummy_test_message_id> 501 In-Reply-To: <dummy_test_message_id>
501 Subject: [issue1] Testing... 502 Subject: [issue1] Testing...
502 503
503 This is a followup 504 This is a followup
504 ''') 505 ''')
505 handler = self.instance.MailGW(self.instance, self.db) 506 handler = self.instance.MailGW(self.instance, self.db)
506 handler.main(message) 507 handler.main(message)
507 508
508 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 509 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
509 '''FROM: roundup-admin@fill.me.in. 510 '''FROM: roundup-admin@your.tracker.email.domain.example
510 TO: chef@bork.bork.bork, richard@test 511 TO: chef@bork.bork.bork, richard@test
511 Content-Type: text/plain 512 Content-Type: text/plain
512 Subject: [issue1] Testing... 513 Subject: [issue1] Testing...
513 To: chef@bork.bork.bork, richard@test 514 To: chef@bork.bork.bork, richard@test
514 From: john <issue_tracker@fill.me.in.> 515 From: john <issue_tracker@your.tracker.email.domain.example>
515 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 516 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
516 MIME-Version: 1.0 517 MIME-Version: 1.0
517 Message-Id: <followup_dummy_id> 518 Message-Id: <followup_dummy_id>
518 In-Reply-To: <dummy_test_message_id> 519 In-Reply-To: <dummy_test_message_id>
519 X-Roundup-Name: Roundup issue tracker 520 X-Roundup-Name: Roundup issue tracker
520 Content-Transfer-Encoding: quoted-printable 521 Content-Transfer-Encoding: quoted-printable
525 This is a followup 526 This is a followup
526 527
527 528
528 ---------- 529 ----------
529 status: unread -> chatting 530 status: unread -> chatting
530 ___________________________________________________ 531 _________________________________________________________________________
531 "Roundup issue tracker" <issue_tracker@fill.me.in.> 532 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
532 http://some.useful.url/issue1 533 http://your.tracker.url.example/issue1
533 ___________________________________________________ 534 _________________________________________________________________________
534 535
535 ''') 536 ''')
536 537
537 def testFollowupNoNosyRecipients(self): 538 def testFollowupNoNosyRecipients(self):
538 self.testNewIssue() 539 self.testNewIssue()
539 self.instance.ADD_RECIPIENTS_TO_NOSY = 'no' 540 self.instance.ADD_RECIPIENTS_TO_NOSY = 'no'
540 message = cStringIO.StringIO('''Content-Type: text/plain; 541 message = cStringIO.StringIO('''Content-Type: text/plain;
541 charset="iso-8859-1" 542 charset="iso-8859-1"
542 From: richard@test 543 From: richard@test
543 To: issue_tracker@fill.me.in. 544 To: issue_tracker@your.tracker.email.domain.example
544 Cc: john@test 545 Cc: john@test
545 Message-Id: <followup_dummy_id> 546 Message-Id: <followup_dummy_id>
546 In-Reply-To: <dummy_test_message_id> 547 In-Reply-To: <dummy_test_message_id>
547 Subject: [issue1] Testing... 548 Subject: [issue1] Testing...
548 549
550 ''') 551 ''')
551 handler = self.instance.MailGW(self.instance, self.db) 552 handler = self.instance.MailGW(self.instance, self.db)
552 handler.main(message) 553 handler.main(message)
553 554
554 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 555 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
555 '''FROM: roundup-admin@fill.me.in. 556 '''FROM: roundup-admin@your.tracker.email.domain.example
556 TO: chef@bork.bork.bork 557 TO: chef@bork.bork.bork
557 Content-Type: text/plain 558 Content-Type: text/plain
558 Subject: [issue1] Testing... 559 Subject: [issue1] Testing...
559 To: chef@bork.bork.bork 560 To: chef@bork.bork.bork
560 From: richard <issue_tracker@fill.me.in.> 561 From: richard <issue_tracker@your.tracker.email.domain.example>
561 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 562 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
562 MIME-Version: 1.0 563 MIME-Version: 1.0
563 Message-Id: <followup_dummy_id> 564 Message-Id: <followup_dummy_id>
564 In-Reply-To: <dummy_test_message_id> 565 In-Reply-To: <dummy_test_message_id>
565 X-Roundup-Name: Roundup issue tracker 566 X-Roundup-Name: Roundup issue tracker
566 Content-Transfer-Encoding: quoted-printable 567 Content-Transfer-Encoding: quoted-printable
571 This is a followup 572 This is a followup
572 573
573 574
574 ---------- 575 ----------
575 status: unread -> chatting 576 status: unread -> chatting
576 ___________________________________________________ 577 _________________________________________________________________________
577 "Roundup issue tracker" <issue_tracker@fill.me.in.> 578 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
578 http://some.useful.url/issue1 579 http://your.tracker.url.example/issue1
579 ___________________________________________________ 580 _________________________________________________________________________
580 581
581 ''') 582 ''')
582 583
583 def testEnc01(self): 584 def testEnc01(self):
584 self.testNewIssue() 585 self.testNewIssue()
585 message = cStringIO.StringIO('''Content-Type: text/plain; 586 message = cStringIO.StringIO('''Content-Type: text/plain;
586 charset="iso-8859-1" 587 charset="iso-8859-1"
587 From: mary <mary@test> 588 From: mary <mary@test>
588 To: issue_tracker@fill.me.in. 589 To: issue_tracker@your.tracker.email.domain.example
589 Message-Id: <followup_dummy_id> 590 Message-Id: <followup_dummy_id>
590 In-Reply-To: <dummy_test_message_id> 591 In-Reply-To: <dummy_test_message_id>
591 Subject: [issue1] Testing... 592 Subject: [issue1] Testing...
592 Content-Type: text/plain; 593 Content-Type: text/plain;
593 charset="iso-8859-1" 594 charset="iso-8859-1"
597 598
598 ''') 599 ''')
599 handler = self.instance.MailGW(self.instance, self.db) 600 handler = self.instance.MailGW(self.instance, self.db)
600 handler.main(message) 601 handler.main(message)
601 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 602 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
602 '''FROM: roundup-admin@fill.me.in. 603 '''FROM: roundup-admin@your.tracker.email.domain.example
603 TO: chef@bork.bork.bork, richard@test 604 TO: chef@bork.bork.bork, richard@test
604 Content-Type: text/plain 605 Content-Type: text/plain
605 Subject: [issue1] Testing... 606 Subject: [issue1] Testing...
606 To: chef@bork.bork.bork, richard@test 607 To: chef@bork.bork.bork, richard@test
607 From: mary <issue_tracker@fill.me.in.> 608 From: mary <issue_tracker@your.tracker.email.domain.example>
608 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 609 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
609 MIME-Version: 1.0 610 MIME-Version: 1.0
610 Message-Id: <followup_dummy_id> 611 Message-Id: <followup_dummy_id>
611 In-Reply-To: <dummy_test_message_id> 612 In-Reply-To: <dummy_test_message_id>
612 X-Roundup-Name: Roundup issue tracker 613 X-Roundup-Name: Roundup issue tracker
613 Content-Transfer-Encoding: quoted-printable 614 Content-Transfer-Encoding: quoted-printable
617 618
618 A message with encoding (encoded oe =F6) 619 A message with encoding (encoded oe =F6)
619 620
620 ---------- 621 ----------
621 status: unread -> chatting 622 status: unread -> chatting
622 ___________________________________________________ 623 _________________________________________________________________________
623 "Roundup issue tracker" <issue_tracker@fill.me.in.> 624 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
624 http://some.useful.url/issue1 625 http://your.tracker.url.example/issue1
625 ___________________________________________________ 626 _________________________________________________________________________
626 ''') 627 ''')
627 628
628 629
629 def testMultipartEnc01(self): 630 def testMultipartEnc01(self):
630 self.testNewIssue() 631 self.testNewIssue()
631 message = cStringIO.StringIO('''Content-Type: text/plain; 632 message = cStringIO.StringIO('''Content-Type: text/plain;
632 charset="iso-8859-1" 633 charset="iso-8859-1"
633 From: mary <mary@test> 634 From: mary <mary@test>
634 To: issue_tracker@fill.me.in. 635 To: issue_tracker@your.tracker.email.domain.example
635 Message-Id: <followup_dummy_id> 636 Message-Id: <followup_dummy_id>
636 In-Reply-To: <dummy_test_message_id> 637 In-Reply-To: <dummy_test_message_id>
637 Subject: [issue1] Testing... 638 Subject: [issue1] Testing...
638 Content-Type: multipart/mixed; 639 Content-Type: multipart/mixed;
639 boundary="----_=_NextPart_000_01" 640 boundary="----_=_NextPart_000_01"
650 651
651 ''') 652 ''')
652 handler = self.instance.MailGW(self.instance, self.db) 653 handler = self.instance.MailGW(self.instance, self.db)
653 handler.main(message) 654 handler.main(message)
654 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), 655 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
655 '''FROM: roundup-admin@fill.me.in. 656 '''FROM: roundup-admin@your.tracker.email.domain.example
656 TO: chef@bork.bork.bork, richard@test 657 TO: chef@bork.bork.bork, richard@test
657 Content-Type: text/plain 658 Content-Type: text/plain
658 Subject: [issue1] Testing... 659 Subject: [issue1] Testing...
659 To: chef@bork.bork.bork, richard@test 660 To: chef@bork.bork.bork, richard@test
660 From: mary <issue_tracker@fill.me.in.> 661 From: mary <issue_tracker@your.tracker.email.domain.example>
661 Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> 662 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
662 MIME-Version: 1.0 663 MIME-Version: 1.0
663 Message-Id: <followup_dummy_id> 664 Message-Id: <followup_dummy_id>
664 In-Reply-To: <dummy_test_message_id> 665 In-Reply-To: <dummy_test_message_id>
665 X-Roundup-Name: Roundup issue tracker 666 X-Roundup-Name: Roundup issue tracker
666 Content-Transfer-Encoding: quoted-printable 667 Content-Transfer-Encoding: quoted-printable
670 671
671 A message with first part encoded (encoded oe =F6) 672 A message with first part encoded (encoded oe =F6)
672 673
673 ---------- 674 ----------
674 status: unread -> chatting 675 status: unread -> chatting
675 ___________________________________________________ 676 _________________________________________________________________________
676 "Roundup issue tracker" <issue_tracker@fill.me.in.> 677 "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example>
677 http://some.useful.url/issue1 678 http://your.tracker.url.example/issue1
678 ___________________________________________________ 679 _________________________________________________________________________
679 ''') 680 ''')
680 681
681 class ExtMailgwTestCase(MailgwTestCase): 682 class ExtMailgwTestCase(MailgwTestCase):
682 schema = 'extended' 683 schema = 'extended'
683 684
688 return unittest.TestSuite(l) 689 return unittest.TestSuite(l)
689 690
690 691
691 # 692 #
692 # $Log: not supported by cvs2svn $ 693 # $Log: not supported by cvs2svn $
694 # Revision 1.18 2002/05/15 03:27:16 richard
695 # . fixed SCRIPT_NAME in ZRoundup for instances not at top level of Zope
696 # (thanks dman)
697 # . fixed some sorting issues that were breaking some unit tests under py2.2
698 # . mailgw test output dir was confusing the init test (but only on 2.2 *shrug*)
699 #
700 # fixed bug in the init unit test that meant only the bsddb test ran if it
701 # could (it clobbered the anydbm test)
702 #
693 # Revision 1.17 2002/05/02 07:56:34 richard 703 # Revision 1.17 2002/05/02 07:56:34 richard
694 # . added option to automatically add the authors and recipients of messages 704 # . added option to automatically add the authors and recipients of messages
695 # to the nosy lists with the options ADD_AUTHOR_TO_NOSY (default 'new') and 705 # to the nosy lists with the options ADD_AUTHOR_TO_NOSY (default 'new') and
696 # ADD_RECIPIENTS_TO_NOSY (default 'new'). These settings emulate the current 706 # ADD_RECIPIENTS_TO_NOSY (default 'new'). These settings emulate the current
697 # behaviour. Setting them to 'yes' will add the author/recipients to the nosy 707 # behaviour. Setting them to 'yes' will add the author/recipients to the nosy

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