Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 2199:340497d2381e maint-0.6
make mailgw tests work with other backends
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 09 Apr 2004 01:28:58 +0000 |
| parents | cf7941a669d6 |
| children |
comparison
equal
deleted
inserted
replaced
| 2192:1448e62cdd51 | 2199:340497d2381e |
|---|---|
| 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.46.2.1 2004-04-01 00:07:35 richard Exp $ | 11 # $Id: test_mailgw.py,v 1.46.2.2 2004-04-09 01:28:58 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 import rfc822 | 14 import rfc822 |
| 15 | 15 |
| 16 # Note: Should parse emails according to RFC2822 instead of performing a | 16 # Note: Should parse emails according to RFC2822 instead of performing a |
| 93 try: | 93 try: |
| 94 shutil.rmtree(self.dirname) | 94 shutil.rmtree(self.dirname) |
| 95 except OSError, error: | 95 except OSError, error: |
| 96 if error.errno not in (errno.ENOENT, errno.ESRCH): raise | 96 if error.errno not in (errno.ENOENT, errno.ESRCH): raise |
| 97 | 97 |
| 98 def handleMessage(self, message): | |
| 99 handler = self.instance.MailGW(self.instance, self.db) | |
| 100 handler.trapExceptions = 0 | |
| 101 nodeid = handler.main(message) | |
| 102 # handler will probably close & reopen the db | |
| 103 self.db = handler.db | |
| 104 return nodeid | |
| 105 | |
| 98 def testEmptyMessage(self): | 106 def testEmptyMessage(self): |
| 99 message = cStringIO.StringIO('''Content-Type: text/plain; | 107 message = cStringIO.StringIO('''Content-Type: text/plain; |
| 100 charset="iso-8859-1" | 108 charset="iso-8859-1" |
| 101 From: Chef <chef@bork.bork.bork> | 109 From: Chef <chef@bork.bork.bork> |
| 102 To: issue_tracker@your.tracker.email.domain.example | 110 To: issue_tracker@your.tracker.email.domain.example |
| 103 Cc: richard@test | 111 Cc: richard@test |
| 104 Message-Id: <dummy_test_message_id> | 112 Message-Id: <dummy_test_message_id> |
| 105 Subject: [issue] Testing... | 113 Subject: [issue] Testing... |
| 106 | 114 |
| 107 ''') | 115 ''') |
| 108 handler = self.instance.MailGW(self.instance, self.db) | 116 nodeid = self.handleMessage(message) |
| 109 handler.trapExceptions = 0 | |
| 110 nodeid = handler.main(message) | |
| 111 if os.path.exists(os.environ['SENDMAILDEBUG']): | 117 if os.path.exists(os.environ['SENDMAILDEBUG']): |
| 112 error = open(os.environ['SENDMAILDEBUG']).read() | 118 error = open(os.environ['SENDMAILDEBUG']).read() |
| 113 self.assertEqual('no error', error) | 119 self.assertEqual('no error', error) |
| 114 self.assertEqual(self.db.issue.get(nodeid, 'title'), 'Testing...') | 120 self.assertEqual(self.db.issue.get(nodeid, 'title'), 'Testing...') |
| 115 | 121 |
| 122 Message-Id: <dummy_test_message_id> | 128 Message-Id: <dummy_test_message_id> |
| 123 Subject: [issue] Testing... | 129 Subject: [issue] Testing... |
| 124 | 130 |
| 125 This is a test submission of a new issue. | 131 This is a test submission of a new issue. |
| 126 ''') | 132 ''') |
| 127 handler = self.instance.MailGW(self.instance, self.db) | 133 nodeid = self.handleMessage(message) |
| 128 handler.trapExceptions = 0 | |
| 129 nodeid = handler.main(message) | |
| 130 if os.path.exists(os.environ['SENDMAILDEBUG']): | 134 if os.path.exists(os.environ['SENDMAILDEBUG']): |
| 131 error = open(os.environ['SENDMAILDEBUG']).read() | 135 error = open(os.environ['SENDMAILDEBUG']).read() |
| 132 self.assertEqual('no error', error) | 136 self.assertEqual('no error', error) |
| 133 l = self.db.issue.get(nodeid, 'nosy') | 137 l = self.db.issue.get(nodeid, 'nosy') |
| 134 l.sort() | 138 l.sort() |
| 148 Message-Id: <dummy_test_message_id> | 152 Message-Id: <dummy_test_message_id> |
| 149 Subject: [issue] Testing... | 153 Subject: [issue] Testing... |
| 150 | 154 |
| 151 This is a test submission of a new issue. | 155 This is a test submission of a new issue. |
| 152 ''') | 156 ''') |
| 153 handler = self.instance.MailGW(self.instance, self.db) | 157 nodeid = self.handleMessage(message) |
| 154 handler.trapExceptions = 0 | |
| 155 nodeid = handler.main(message) | |
| 156 if os.path.exists(os.environ['SENDMAILDEBUG']): | 158 if os.path.exists(os.environ['SENDMAILDEBUG']): |
| 157 error = open(os.environ['SENDMAILDEBUG']).read() | 159 error = open(os.environ['SENDMAILDEBUG']).read() |
| 158 self.assertEqual('no error', error) | 160 self.assertEqual('no error', error) |
| 159 l = self.db.issue.get(nodeid, 'nosy') | 161 l = self.db.issue.get(nodeid, 'nosy') |
| 160 l.sort() | 162 l.sort() |
| 161 self.assertEqual(l, ['3', '4']) | 163 self.assertEqual(l, ['3', '4']) |
| 162 | 164 |
| 163 def testAlternateAddress(self): | 165 def testNewUser(self): |
| 164 message = cStringIO.StringIO('''Content-Type: text/plain; | 166 message = cStringIO.StringIO('''Content-Type: text/plain; |
| 165 charset="iso-8859-1" | 167 charset="iso-8859-1" |
| 166 From: John Doe <john.doe@test> | 168 From: Frank Fiddle <frank@fiddle.com> |
| 167 To: issue_tracker@your.tracker.email.domain.example | 169 To: issue_tracker@your.tracker.email.domain.example |
| 168 Message-Id: <dummy_test_message_id> | 170 Message-Id: <dummy_test_message_id> |
| 169 Subject: [issue] Testing... | 171 Subject: [issue] Testing... |
| 170 | 172 |
| 171 This is a test submission of a new issue. | 173 This is a test submission of a new issue. |
| 172 ''') | 174 ''') |
| 173 userlist = self.db.user.list() | 175 userlist = self.db.user.list() |
| 174 handler = self.instance.MailGW(self.instance, self.db) | 176 nodeid = self.handleMessage(message) |
| 175 handler.trapExceptions = 0 | 177 if os.path.exists(os.environ['SENDMAILDEBUG']): |
| 176 handler.main(message) | 178 error = open(os.environ['SENDMAILDEBUG']).read() |
| 179 self.assertEqual('no error', error) | |
| 180 self.assertNotEqual(userlist, self.db.user.list(), | |
| 181 "user not created when it should have been") | |
| 182 | |
| 183 def testAlternateAddress(self): | |
| 184 message = cStringIO.StringIO('''Content-Type: text/plain; | |
| 185 charset="iso-8859-1" | |
| 186 From: John Doe <john.doe@test> | |
| 187 To: issue_tracker@your.tracker.email.domain.example | |
| 188 Message-Id: <dummy_test_message_id> | |
| 189 Subject: [issue] Testing... | |
| 190 | |
| 191 This is a test submission of a new issue. | |
| 192 ''') | |
| 193 userlist = self.db.user.list() | |
| 194 nodeid = self.handleMessage(message) | |
| 177 if os.path.exists(os.environ['SENDMAILDEBUG']): | 195 if os.path.exists(os.environ['SENDMAILDEBUG']): |
| 178 error = open(os.environ['SENDMAILDEBUG']).read() | 196 error = open(os.environ['SENDMAILDEBUG']).read() |
| 179 self.assertEqual('no error', error) | 197 self.assertEqual('no error', error) |
| 180 self.assertEqual(userlist, self.db.user.list(), | 198 self.assertEqual(userlist, self.db.user.list(), |
| 181 "user created when it shouldn't have been") | 199 "user created when it shouldn't have been") |
| 189 Message-Id: <dummy_test_message_id> | 207 Message-Id: <dummy_test_message_id> |
| 190 Subject: Testing... | 208 Subject: Testing... |
| 191 | 209 |
| 192 This is a test submission of a new issue. | 210 This is a test submission of a new issue. |
| 193 ''') | 211 ''') |
| 194 handler = self.instance.MailGW(self.instance, self.db) | 212 nodeid = self.handleMessage(message) |
| 195 handler.trapExceptions = 0 | |
| 196 handler.main(message) | |
| 197 if os.path.exists(os.environ['SENDMAILDEBUG']): | 213 if os.path.exists(os.environ['SENDMAILDEBUG']): |
| 198 error = open(os.environ['SENDMAILDEBUG']).read() | 214 error = open(os.environ['SENDMAILDEBUG']).read() |
| 199 self.assertEqual('no error', error) | 215 self.assertEqual('no error', error) |
| 200 | 216 |
| 201 def testNewIssueAuthMsg(self): | 217 def testNewIssueAuthMsg(self): |
| 206 Message-Id: <dummy_test_message_id> | 222 Message-Id: <dummy_test_message_id> |
| 207 Subject: [issue] Testing... [nosy=mary; assignedto=richard] | 223 Subject: [issue] Testing... [nosy=mary; assignedto=richard] |
| 208 | 224 |
| 209 This is a test submission of a new issue. | 225 This is a test submission of a new issue. |
| 210 ''') | 226 ''') |
| 211 handler = self.instance.MailGW(self.instance, self.db) | |
| 212 handler.trapExceptions = 0 | |
| 213 # TODO: fix the damn config - this is apalling | 227 # TODO: fix the damn config - this is apalling |
| 214 self.db.config.MESSAGES_TO_AUTHOR = 'yes' | 228 self.db.config.MESSAGES_TO_AUTHOR = 'yes' |
| 215 handler.main(message) | 229 nodeid = self.handleMessage(message) |
| 216 | 230 |
| 217 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 231 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 218 '''FROM: roundup-admin@your.tracker.email.domain.example | 232 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 219 TO: chef@bork.bork.bork, mary@test, richard@test | 233 TO: chef@bork.bork.bork, mary@test, richard@test |
| 220 Content-Type: text/plain; charset=utf-8 | 234 Content-Type: text/plain; charset=utf-8 |
| 265 In-Reply-To: <dummy_test_message_id> | 279 In-Reply-To: <dummy_test_message_id> |
| 266 Subject: [issue1] Testing... | 280 Subject: [issue1] Testing... |
| 267 | 281 |
| 268 This is a second followup | 282 This is a second followup |
| 269 ''') | 283 ''') |
| 270 handler = self.instance.MailGW(self.instance, self.db) | 284 self.handleMessage(message) |
| 271 handler.trapExceptions = 0 | |
| 272 handler.main(message) | |
| 273 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 285 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 274 '''FROM: roundup-admin@your.tracker.email.domain.example | 286 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 275 TO: chef@bork.bork.bork, richard@test | 287 TO: chef@bork.bork.bork, richard@test |
| 276 Content-Type: text/plain; charset=utf-8 | 288 Content-Type: text/plain; charset=utf-8 |
| 277 Subject: [issue1] Testing... | 289 Subject: [issue1] Testing... |
| 310 In-Reply-To: <dummy_test_message_id> | 322 In-Reply-To: <dummy_test_message_id> |
| 311 Subject: [issue1] Testing... [assignedto=mary; nosy=+john] | 323 Subject: [issue1] Testing... [assignedto=mary; nosy=+john] |
| 312 | 324 |
| 313 This is a followup | 325 This is a followup |
| 314 ''') | 326 ''') |
| 315 handler = self.instance.MailGW(self.instance, self.db) | 327 self.handleMessage(message) |
| 316 handler.trapExceptions = 0 | |
| 317 handler.main(message) | |
| 318 l = self.db.issue.get('1', 'nosy') | 328 l = self.db.issue.get('1', 'nosy') |
| 319 l.sort() | 329 l.sort() |
| 320 self.assertEqual(l, ['3', '4', '5', '6']) | 330 self.assertEqual(l, ['3', '4', '5', '6']) |
| 321 | 331 |
| 322 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 332 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 360 In-Reply-To: <dummy_test_message_id> | 370 In-Reply-To: <dummy_test_message_id> |
| 361 Subject: Re: Testing... [assignedto=mary; nosy=+john] | 371 Subject: Re: Testing... [assignedto=mary; nosy=+john] |
| 362 | 372 |
| 363 This is a followup | 373 This is a followup |
| 364 ''') | 374 ''') |
| 365 handler = self.instance.MailGW(self.instance, self.db) | 375 self.handleMessage(message) |
| 366 handler.trapExceptions = 0 | |
| 367 handler.main(message) | |
| 368 | 376 |
| 369 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 377 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 370 '''FROM: roundup-admin@your.tracker.email.domain.example | 378 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 371 TO: chef@bork.bork.bork, john@test, mary@test | 379 TO: chef@bork.bork.bork, john@test, mary@test |
| 372 Content-Type: text/plain; charset=utf-8 | 380 Content-Type: text/plain; charset=utf-8 |
| 408 In-Reply-To: <dummy_test_message_id> | 416 In-Reply-To: <dummy_test_message_id> |
| 409 Subject: [issue1] Testing... | 417 Subject: [issue1] Testing... |
| 410 | 418 |
| 411 This is a followup | 419 This is a followup |
| 412 ''') | 420 ''') |
| 413 handler = self.instance.MailGW(self.instance, self.db) | 421 self.handleMessage(message) |
| 414 handler.trapExceptions = 0 | |
| 415 handler.main(message) | |
| 416 | 422 |
| 417 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 423 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 418 '''FROM: roundup-admin@your.tracker.email.domain.example | 424 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 419 TO: chef@bork.bork.bork, richard@test | 425 TO: chef@bork.bork.bork, richard@test |
| 420 Content-Type: text/plain; charset=utf-8 | 426 Content-Type: text/plain; charset=utf-8 |
| 457 In-Reply-To: <dummy_test_message_id> | 463 In-Reply-To: <dummy_test_message_id> |
| 458 Subject: [issue1] Testing... | 464 Subject: [issue1] Testing... |
| 459 | 465 |
| 460 This is a followup | 466 This is a followup |
| 461 ''') | 467 ''') |
| 462 handler = self.instance.MailGW(self.instance, self.db) | 468 self.handleMessage(message) |
| 463 handler.trapExceptions = 0 | |
| 464 handler.main(message) | |
| 465 | 469 |
| 466 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 470 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 467 '''FROM: roundup-admin@your.tracker.email.domain.example | 471 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 468 TO: chef@bork.bork.bork | 472 TO: chef@bork.bork.bork |
| 469 Content-Type: text/plain; charset=utf-8 | 473 Content-Type: text/plain; charset=utf-8 |
| 506 In-Reply-To: <dummy_test_message_id> | 510 In-Reply-To: <dummy_test_message_id> |
| 507 Subject: [issue1] Testing... | 511 Subject: [issue1] Testing... |
| 508 | 512 |
| 509 This is a followup | 513 This is a followup |
| 510 ''') | 514 ''') |
| 511 handler = self.instance.MailGW(self.instance, self.db) | 515 self.handleMessage(message) |
| 512 handler.trapExceptions = 0 | |
| 513 handler.main(message) | |
| 514 | 516 |
| 515 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 517 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 516 '''FROM: roundup-admin@your.tracker.email.domain.example | 518 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 517 TO: chef@bork.bork.bork, john@test, richard@test | 519 TO: chef@bork.bork.bork, john@test, richard@test |
| 518 Content-Type: text/plain; charset=utf-8 | 520 Content-Type: text/plain; charset=utf-8 |
| 554 In-Reply-To: <dummy_test_message_id> | 556 In-Reply-To: <dummy_test_message_id> |
| 555 Subject: [issue1] Testing... | 557 Subject: [issue1] Testing... |
| 556 | 558 |
| 557 This is a followup | 559 This is a followup |
| 558 ''') | 560 ''') |
| 559 handler = self.instance.MailGW(self.instance, self.db) | 561 self.handleMessage(message) |
| 560 handler.trapExceptions = 0 | |
| 561 handler.main(message) | |
| 562 | 562 |
| 563 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 563 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 564 '''FROM: roundup-admin@your.tracker.email.domain.example | 564 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 565 TO: chef@bork.bork.bork, richard@test | 565 TO: chef@bork.bork.bork, richard@test |
| 566 Content-Type: text/plain; charset=utf-8 | 566 Content-Type: text/plain; charset=utf-8 |
| 602 In-Reply-To: <dummy_test_message_id> | 602 In-Reply-To: <dummy_test_message_id> |
| 603 Subject: [issue1] Testing... | 603 Subject: [issue1] Testing... |
| 604 | 604 |
| 605 This is a followup | 605 This is a followup |
| 606 ''') | 606 ''') |
| 607 handler = self.instance.MailGW(self.instance, self.db) | 607 self.handleMessage(message) |
| 608 handler.trapExceptions = 0 | |
| 609 handler.main(message) | |
| 610 | 608 |
| 611 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 609 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 612 '''FROM: roundup-admin@your.tracker.email.domain.example | 610 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 613 TO: chef@bork.bork.bork | 611 TO: chef@bork.bork.bork |
| 614 Content-Type: text/plain; charset=utf-8 | 612 Content-Type: text/plain; charset=utf-8 |
| 648 Message-Id: <followup_dummy_id> | 646 Message-Id: <followup_dummy_id> |
| 649 In-Reply-To: <dummy_test_message_id> | 647 In-Reply-To: <dummy_test_message_id> |
| 650 Subject: [issue1] Testing... [assignedto=mary; nosy=+john] | 648 Subject: [issue1] Testing... [assignedto=mary; nosy=+john] |
| 651 | 649 |
| 652 ''') | 650 ''') |
| 653 handler = self.instance.MailGW(self.instance, self.db) | 651 self.handleMessage(message) |
| 654 handler.trapExceptions = 0 | |
| 655 handler.main(message) | |
| 656 l = self.db.issue.get('1', 'nosy') | 652 l = self.db.issue.get('1', 'nosy') |
| 657 l.sort() | 653 l.sort() |
| 658 self.assertEqual(l, ['3', '4', '5', '6']) | 654 self.assertEqual(l, ['3', '4', '5', '6']) |
| 659 | 655 |
| 660 # should be no file created (ie. no message) | 656 # should be no file created (ie. no message) |
| 670 Message-Id: <followup_dummy_id> | 666 Message-Id: <followup_dummy_id> |
| 671 In-Reply-To: <dummy_test_message_id> | 667 In-Reply-To: <dummy_test_message_id> |
| 672 Subject: [issue1] Testing... [nosy=-richard] | 668 Subject: [issue1] Testing... [nosy=-richard] |
| 673 | 669 |
| 674 ''') | 670 ''') |
| 675 handler = self.instance.MailGW(self.instance, self.db) | 671 self.handleMessage(message) |
| 676 handler.trapExceptions = 0 | |
| 677 handler.main(message) | |
| 678 l = self.db.issue.get('1', 'nosy') | 672 l = self.db.issue.get('1', 'nosy') |
| 679 l.sort() | 673 l.sort() |
| 680 self.assertEqual(l, ['3']) | 674 self.assertEqual(l, ['3']) |
| 681 | 675 |
| 682 # NO NOSY MESSAGE SHOULD BE SENT! | 676 # NO NOSY MESSAGE SHOULD BE SENT! |
| 700 Subject: [issue] Testing... | 694 Subject: [issue] Testing... |
| 701 | 695 |
| 702 This is a test submission of a new issue. | 696 This is a test submission of a new issue. |
| 703 ''' | 697 ''' |
| 704 message = cStringIO.StringIO(s) | 698 message = cStringIO.StringIO(s) |
| 705 handler = self.instance.MailGW(self.instance, self.db) | 699 self.assertRaises(Unauthorized, self.handleMessage, message) |
| 706 handler.trapExceptions = 0 | |
| 707 self.assertRaises(Unauthorized, handler.main, message) | |
| 708 m = self.db.user.list() | 700 m = self.db.user.list() |
| 709 m.sort() | 701 m.sort() |
| 710 self.assertEqual(l, m) | 702 self.assertEqual(l, m) |
| 711 | 703 |
| 712 # now with the permission | 704 # now with the permission |
| 713 p = self.db.security.getPermission('Email Registration') | 705 p = self.db.security.getPermission('Email Registration') |
| 714 self.db.security.role['anonymous'].permissions=[p] | 706 self.db.security.role['anonymous'].permissions=[p] |
| 715 handler = self.instance.MailGW(self.instance, self.db) | |
| 716 handler.trapExceptions = 0 | |
| 717 message = cStringIO.StringIO(s) | 707 message = cStringIO.StringIO(s) |
| 718 handler.main(message) | 708 self.handleMessage(message) |
| 719 m = self.db.user.list() | 709 m = self.db.user.list() |
| 720 m.sort() | 710 m.sort() |
| 721 self.assertNotEqual(l, m) | 711 self.assertNotEqual(l, m) |
| 722 | 712 |
| 723 def testEnc01(self): | 713 def testEnc01(self): |
| 734 Content-Transfer-Encoding: quoted-printable | 724 Content-Transfer-Encoding: quoted-printable |
| 735 | 725 |
| 736 A message with encoding (encoded oe =F6) | 726 A message with encoding (encoded oe =F6) |
| 737 | 727 |
| 738 ''') | 728 ''') |
| 739 handler = self.instance.MailGW(self.instance, self.db) | 729 self.handleMessage(message) |
| 740 handler.trapExceptions = 0 | |
| 741 handler.main(message) | |
| 742 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 730 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 743 '''FROM: roundup-admin@your.tracker.email.domain.example | 731 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 744 TO: chef@bork.bork.bork, richard@test | 732 TO: chef@bork.bork.bork, richard@test |
| 745 Content-Type: text/plain; charset=utf-8 | 733 Content-Type: text/plain; charset=utf-8 |
| 746 Subject: [issue1] Testing... | 734 Subject: [issue1] Testing... |
| 790 Content-Transfer-Encoding: quoted-printable | 778 Content-Transfer-Encoding: quoted-printable |
| 791 | 779 |
| 792 A message with first part encoded (encoded oe =F6) | 780 A message with first part encoded (encoded oe =F6) |
| 793 | 781 |
| 794 ''') | 782 ''') |
| 795 handler = self.instance.MailGW(self.instance, self.db) | 783 self.handleMessage(message) |
| 796 handler.trapExceptions = 0 | |
| 797 handler.main(message) | |
| 798 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 784 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 799 '''FROM: roundup-admin@your.tracker.email.domain.example | 785 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 800 TO: chef@bork.bork.bork, richard@test | 786 TO: chef@bork.bork.bork, richard@test |
| 801 Content-Type: text/plain; charset=utf-8 | 787 Content-Type: text/plain; charset=utf-8 |
| 802 Subject: [issue1] Testing... | 788 Subject: [issue1] Testing... |
| 849 | 835 |
| 850 xxxxxx | 836 xxxxxx |
| 851 | 837 |
| 852 --bCsyhTFzCvuiizWE-- | 838 --bCsyhTFzCvuiizWE-- |
| 853 ''') | 839 ''') |
| 854 handler = self.instance.MailGW(self.instance, self.db) | 840 self.handleMessage(message) |
| 855 handler.trapExceptions = 0 | |
| 856 handler.main(message) | |
| 857 messages = self.db.issue.get('1', 'messages') | 841 messages = self.db.issue.get('1', 'messages') |
| 858 messages.sort() | 842 messages.sort() |
| 859 file = self.db.msg.get(messages[-1], 'files')[0] | 843 file = self.db.msg.get(messages[-1], 'files')[0] |
| 860 self.assertEqual(self.db.file.get(file, 'name'), 'main.dvi') | 844 self.assertEqual(self.db.file.get(file, 'name'), 'main.dvi') |
| 861 | 845 |
| 870 In-Reply-To: <dummy_test_message_id> | 854 In-Reply-To: <dummy_test_message_id> |
| 871 Subject: Re: "[issue1] Testing... " | 855 Subject: Re: "[issue1] Testing... " |
| 872 | 856 |
| 873 This is a followup | 857 This is a followup |
| 874 ''') | 858 ''') |
| 875 handler = self.instance.MailGW(self.instance, self.db) | 859 self.handleMessage(message) |
| 876 handler.trapExceptions = 0 | |
| 877 handler.main(message) | |
| 878 | 860 |
| 879 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), | 861 self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), |
| 880 '''FROM: roundup-admin@your.tracker.email.domain.example | 862 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 881 TO: chef@bork.bork.bork | 863 TO: chef@bork.bork.bork |
| 882 Content-Type: text/plain; charset=utf-8 | 864 Content-Type: text/plain; charset=utf-8 |
| 938 > skdjlkjsdfalsdkfjasdlfkj dlfksdfalksd fj | 920 > skdjlkjsdfalsdkfjasdlfkj dlfksdfalksd fj |
| 939 > | 921 > |
| 940 | 922 |
| 941 This is a followup | 923 This is a followup |
| 942 ''') | 924 ''') |
| 943 handler = self.instance.MailGW(self.instance, self.db) | 925 self.handleMessage(message) |
| 944 handler.trapExceptions = 0 | |
| 945 handler.main(message) | |
| 946 | 926 |
| 947 # figure the new message id | 927 # figure the new message id |
| 948 newmessages = self.db.issue.get(nodeid, 'messages') | 928 newmessages = self.db.issue.get(nodeid, 'messages') |
| 949 for msg in messages: | 929 for msg in messages: |
| 950 newmessages.remove(msg) | 930 newmessages.remove(msg) |
