Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 777:bcd284bba81f
Updated message strings...
...to match the RFC822 address quoting performed by the 'email' and
'rfc822' modules. The verification really should use a RFC2822
message parser rather than literal string comparisions to allow for
legal variations in messages.
| author | Derrick Hudson <dman13@users.sourceforge.net> |
|---|---|
| date | Tue, 18 Jun 2002 03:59:59 +0000 |
| parents | 938edfdeac6e |
| children | 34eacaa7e313 |
comparison
equal
deleted
inserted
replaced
| 776:60189cf7ba8e | 777:bcd284bba81f |
|---|---|
| 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.20 2002-05-29 01:16:17 richard Exp $ | 11 # $Id: test_mailgw.py,v 1.21 2002-06-18 03:59:59 dman13 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 | |
| 15 # Note: Should parse emails according to RFC2822 instead of performing a | |
| 16 # literal string comparision. Parsing the messages allows the tests to work for | |
| 17 # any legal serialization of an email. | |
| 18 #try : | |
| 19 # import email | |
| 20 #except ImportError : | |
| 21 # import rfc822 as email | |
| 14 | 22 |
| 15 from roundup.mailgw import MailGW | 23 from roundup.mailgw import MailGW |
| 16 from roundup import init, instance | 24 from roundup import init, instance |
| 17 | 25 |
| 18 # TODO: make this output only enough equal lines for context, not all of | 26 # TODO: make this output only enough equal lines for context, not all of |
| 87 if error.errno not in (errno.ENOENT, errno.ESRCH): raise | 95 if error.errno not in (errno.ENOENT, errno.ESRCH): raise |
| 88 | 96 |
| 89 def doNewIssue(self): | 97 def doNewIssue(self): |
| 90 message = cStringIO.StringIO('''Content-Type: text/plain; | 98 message = cStringIO.StringIO('''Content-Type: text/plain; |
| 91 charset="iso-8859-1" | 99 charset="iso-8859-1" |
| 92 From: Chef <chef@bork.bork.bork | 100 From: Chef <chef@bork.bork.bork> |
| 93 To: issue_tracker@your.tracker.email.domain.example | 101 To: issue_tracker@your.tracker.email.domain.example |
| 94 Cc: richard@test | 102 Cc: richard@test |
| 95 Message-Id: <dummy_test_message_id> | 103 Message-Id: <dummy_test_message_id> |
| 96 Subject: [issue] Testing... | 104 Subject: [issue] Testing... |
| 97 | 105 |
| 111 | 119 |
| 112 def testNewIssueNosy(self): | 120 def testNewIssueNosy(self): |
| 113 self.instance.ADD_AUTHOR_TO_NOSY = 'yes' | 121 self.instance.ADD_AUTHOR_TO_NOSY = 'yes' |
| 114 message = cStringIO.StringIO('''Content-Type: text/plain; | 122 message = cStringIO.StringIO('''Content-Type: text/plain; |
| 115 charset="iso-8859-1" | 123 charset="iso-8859-1" |
| 116 From: Chef <chef@bork.bork.bork | 124 From: Chef <chef@bork.bork.bork> |
| 117 To: issue_tracker@your.tracker.email.domain.example | 125 To: issue_tracker@your.tracker.email.domain.example |
| 118 Cc: richard@test | 126 Cc: richard@test |
| 119 Message-Id: <dummy_test_message_id> | 127 Message-Id: <dummy_test_message_id> |
| 120 Subject: [issue] Testing... | 128 Subject: [issue] Testing... |
| 121 | 129 |
| 150 "user created when it shouldn't have been") | 158 "user created when it shouldn't have been") |
| 151 | 159 |
| 152 def testNewIssueNoClass(self): | 160 def testNewIssueNoClass(self): |
| 153 message = cStringIO.StringIO('''Content-Type: text/plain; | 161 message = cStringIO.StringIO('''Content-Type: text/plain; |
| 154 charset="iso-8859-1" | 162 charset="iso-8859-1" |
| 155 From: Chef <chef@bork.bork.bork | 163 From: Chef <chef@bork.bork.bork> |
| 156 To: issue_tracker@your.tracker.email.domain.example | 164 To: issue_tracker@your.tracker.email.domain.example |
| 157 Cc: richard@test | 165 Cc: richard@test |
| 158 Message-Id: <dummy_test_message_id> | 166 Message-Id: <dummy_test_message_id> |
| 159 Subject: Testing... | 167 Subject: Testing... |
| 160 | 168 |
| 167 self.assertEqual('no error', error) | 175 self.assertEqual('no error', error) |
| 168 | 176 |
| 169 def testNewIssueAuthMsg(self): | 177 def testNewIssueAuthMsg(self): |
| 170 message = cStringIO.StringIO('''Content-Type: text/plain; | 178 message = cStringIO.StringIO('''Content-Type: text/plain; |
| 171 charset="iso-8859-1" | 179 charset="iso-8859-1" |
| 172 From: Chef <chef@bork.bork.bork | 180 From: Chef <chef@bork.bork.bork> |
| 173 To: issue_tracker@your.tracker.email.domain.example | 181 To: issue_tracker@your.tracker.email.domain.example |
| 174 Message-Id: <dummy_test_message_id> | 182 Message-Id: <dummy_test_message_id> |
| 175 Subject: [issue] Testing... [nosy=mary; assignedto=richard] | 183 Subject: [issue] Testing... [nosy=mary; assignedto=richard] |
| 176 | 184 |
| 177 This is a test submission of a new issue. | 185 This is a test submission of a new issue. |
| 185 '''FROM: roundup-admin@your.tracker.email.domain.example | 193 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 186 TO: chef@bork.bork.bork, mary@test, richard@test | 194 TO: chef@bork.bork.bork, mary@test, richard@test |
| 187 Content-Type: text/plain | 195 Content-Type: text/plain |
| 188 Subject: [issue1] Testing... | 196 Subject: [issue1] Testing... |
| 189 To: chef@bork.bork.bork, mary@test, richard@test | 197 To: chef@bork.bork.bork, mary@test, richard@test |
| 190 From: Chef <issue_tracker@your.tracker.email.domain.example> | 198 From: "Chef" <issue_tracker@your.tracker.email.domain.example> |
| 191 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 199 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 192 MIME-Version: 1.0 | 200 MIME-Version: 1.0 |
| 193 Message-Id: <dummy_test_message_id> | 201 Message-Id: <dummy_test_message_id> |
| 194 X-Roundup-Name: Roundup issue tracker | 202 X-Roundup-Name: Roundup issue tracker |
| 195 Content-Transfer-Encoding: quoted-printable | 203 Content-Transfer-Encoding: quoted-printable |
| 196 | 204 |
| 239 '''FROM: roundup-admin@your.tracker.email.domain.example | 247 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 240 TO: chef@bork.bork.bork, richard@test | 248 TO: chef@bork.bork.bork, richard@test |
| 241 Content-Type: text/plain | 249 Content-Type: text/plain |
| 242 Subject: [issue1] Testing... | 250 Subject: [issue1] Testing... |
| 243 To: chef@bork.bork.bork, richard@test | 251 To: chef@bork.bork.bork, richard@test |
| 244 From: mary <issue_tracker@your.tracker.email.domain.example> | 252 From: "mary" <issue_tracker@your.tracker.email.domain.example> |
| 245 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 253 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 246 MIME-Version: 1.0 | 254 MIME-Version: 1.0 |
| 247 Message-Id: <followup_dummy_id> | 255 Message-Id: <followup_dummy_id> |
| 248 In-Reply-To: <dummy_test_message_id> | 256 In-Reply-To: <dummy_test_message_id> |
| 249 X-Roundup-Name: Roundup issue tracker | 257 X-Roundup-Name: Roundup issue tracker |
| 250 Content-Transfer-Encoding: quoted-printable | 258 Content-Transfer-Encoding: quoted-printable |
| 286 '''FROM: roundup-admin@your.tracker.email.domain.example | 294 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 287 TO: chef@bork.bork.bork, john@test, mary@test | 295 TO: chef@bork.bork.bork, john@test, mary@test |
| 288 Content-Type: text/plain | 296 Content-Type: text/plain |
| 289 Subject: [issue1] Testing... | 297 Subject: [issue1] Testing... |
| 290 To: chef@bork.bork.bork, john@test, mary@test | 298 To: chef@bork.bork.bork, john@test, mary@test |
| 291 From: richard <issue_tracker@your.tracker.email.domain.example> | 299 From: "richard" <issue_tracker@your.tracker.email.domain.example> |
| 292 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 300 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 293 MIME-Version: 1.0 | 301 MIME-Version: 1.0 |
| 294 Message-Id: <followup_dummy_id> | 302 Message-Id: <followup_dummy_id> |
| 295 In-Reply-To: <dummy_test_message_id> | 303 In-Reply-To: <dummy_test_message_id> |
| 296 X-Roundup-Name: Roundup issue tracker | 304 X-Roundup-Name: Roundup issue tracker |
| 297 Content-Transfer-Encoding: quoted-printable | 305 Content-Transfer-Encoding: quoted-printable |
| 331 '''FROM: roundup-admin@your.tracker.email.domain.example | 339 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 332 TO: chef@bork.bork.bork, john@test, mary@test | 340 TO: chef@bork.bork.bork, john@test, mary@test |
| 333 Content-Type: text/plain | 341 Content-Type: text/plain |
| 334 Subject: [issue1] Testing... | 342 Subject: [issue1] Testing... |
| 335 To: chef@bork.bork.bork, john@test, mary@test | 343 To: chef@bork.bork.bork, john@test, mary@test |
| 336 From: richard <issue_tracker@your.tracker.email.domain.example> | 344 From: "richard" <issue_tracker@your.tracker.email.domain.example> |
| 337 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 345 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 338 MIME-Version: 1.0 | 346 MIME-Version: 1.0 |
| 339 Message-Id: <followup_dummy_id> | 347 Message-Id: <followup_dummy_id> |
| 340 In-Reply-To: <dummy_test_message_id> | 348 In-Reply-To: <dummy_test_message_id> |
| 341 X-Roundup-Name: Roundup issue tracker | 349 X-Roundup-Name: Roundup issue tracker |
| 342 Content-Transfer-Encoding: quoted-printable | 350 Content-Transfer-Encoding: quoted-printable |
| 377 '''FROM: roundup-admin@your.tracker.email.domain.example | 385 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 378 TO: chef@bork.bork.bork, richard@test | 386 TO: chef@bork.bork.bork, richard@test |
| 379 Content-Type: text/plain | 387 Content-Type: text/plain |
| 380 Subject: [issue1] Testing... | 388 Subject: [issue1] Testing... |
| 381 To: chef@bork.bork.bork, richard@test | 389 To: chef@bork.bork.bork, richard@test |
| 382 From: john <issue_tracker@your.tracker.email.domain.example> | 390 From: "john" <issue_tracker@your.tracker.email.domain.example> |
| 383 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 391 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 384 MIME-Version: 1.0 | 392 MIME-Version: 1.0 |
| 385 Message-Id: <followup_dummy_id> | 393 Message-Id: <followup_dummy_id> |
| 386 In-Reply-To: <dummy_test_message_id> | 394 In-Reply-To: <dummy_test_message_id> |
| 387 X-Roundup-Name: Roundup issue tracker | 395 X-Roundup-Name: Roundup issue tracker |
| 388 Content-Transfer-Encoding: quoted-printable | 396 Content-Transfer-Encoding: quoted-printable |
| 424 '''FROM: roundup-admin@your.tracker.email.domain.example | 432 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 425 TO: chef@bork.bork.bork | 433 TO: chef@bork.bork.bork |
| 426 Content-Type: text/plain | 434 Content-Type: text/plain |
| 427 Subject: [issue1] Testing... | 435 Subject: [issue1] Testing... |
| 428 To: chef@bork.bork.bork | 436 To: chef@bork.bork.bork |
| 429 From: richard <issue_tracker@your.tracker.email.domain.example> | 437 From: "richard" <issue_tracker@your.tracker.email.domain.example> |
| 430 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 438 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 431 MIME-Version: 1.0 | 439 MIME-Version: 1.0 |
| 432 Message-Id: <followup_dummy_id> | 440 Message-Id: <followup_dummy_id> |
| 433 In-Reply-To: <dummy_test_message_id> | 441 In-Reply-To: <dummy_test_message_id> |
| 434 X-Roundup-Name: Roundup issue tracker | 442 X-Roundup-Name: Roundup issue tracker |
| 435 Content-Transfer-Encoding: quoted-printable | 443 Content-Transfer-Encoding: quoted-printable |
| 471 '''FROM: roundup-admin@your.tracker.email.domain.example | 479 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 472 TO: chef@bork.bork.bork, john@test, richard@test | 480 TO: chef@bork.bork.bork, john@test, richard@test |
| 473 Content-Type: text/plain | 481 Content-Type: text/plain |
| 474 Subject: [issue1] Testing... | 482 Subject: [issue1] Testing... |
| 475 To: chef@bork.bork.bork, john@test, richard@test | 483 To: chef@bork.bork.bork, john@test, richard@test |
| 476 From: john <issue_tracker@your.tracker.email.domain.example> | 484 From: "john" <issue_tracker@your.tracker.email.domain.example> |
| 477 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 485 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 478 MIME-Version: 1.0 | 486 MIME-Version: 1.0 |
| 479 Message-Id: <followup_dummy_id> | 487 Message-Id: <followup_dummy_id> |
| 480 In-Reply-To: <dummy_test_message_id> | 488 In-Reply-To: <dummy_test_message_id> |
| 481 X-Roundup-Name: Roundup issue tracker | 489 X-Roundup-Name: Roundup issue tracker |
| 482 Content-Transfer-Encoding: quoted-printable | 490 Content-Transfer-Encoding: quoted-printable |
| 517 '''FROM: roundup-admin@your.tracker.email.domain.example | 525 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 518 TO: chef@bork.bork.bork, richard@test | 526 TO: chef@bork.bork.bork, richard@test |
| 519 Content-Type: text/plain | 527 Content-Type: text/plain |
| 520 Subject: [issue1] Testing... | 528 Subject: [issue1] Testing... |
| 521 To: chef@bork.bork.bork, richard@test | 529 To: chef@bork.bork.bork, richard@test |
| 522 From: john <issue_tracker@your.tracker.email.domain.example> | 530 From: "john" <issue_tracker@your.tracker.email.domain.example> |
| 523 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 531 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 524 MIME-Version: 1.0 | 532 MIME-Version: 1.0 |
| 525 Message-Id: <followup_dummy_id> | 533 Message-Id: <followup_dummy_id> |
| 526 In-Reply-To: <dummy_test_message_id> | 534 In-Reply-To: <dummy_test_message_id> |
| 527 X-Roundup-Name: Roundup issue tracker | 535 X-Roundup-Name: Roundup issue tracker |
| 528 Content-Transfer-Encoding: quoted-printable | 536 Content-Transfer-Encoding: quoted-printable |
| 563 '''FROM: roundup-admin@your.tracker.email.domain.example | 571 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 564 TO: chef@bork.bork.bork | 572 TO: chef@bork.bork.bork |
| 565 Content-Type: text/plain | 573 Content-Type: text/plain |
| 566 Subject: [issue1] Testing... | 574 Subject: [issue1] Testing... |
| 567 To: chef@bork.bork.bork | 575 To: chef@bork.bork.bork |
| 568 From: richard <issue_tracker@your.tracker.email.domain.example> | 576 From: "richard" <issue_tracker@your.tracker.email.domain.example> |
| 569 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 577 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 570 MIME-Version: 1.0 | 578 MIME-Version: 1.0 |
| 571 Message-Id: <followup_dummy_id> | 579 Message-Id: <followup_dummy_id> |
| 572 In-Reply-To: <dummy_test_message_id> | 580 In-Reply-To: <dummy_test_message_id> |
| 573 X-Roundup-Name: Roundup issue tracker | 581 X-Roundup-Name: Roundup issue tracker |
| 574 Content-Transfer-Encoding: quoted-printable | 582 Content-Transfer-Encoding: quoted-printable |
| 631 '''FROM: roundup-admin@your.tracker.email.domain.example | 639 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 632 TO: chef@bork.bork.bork, richard@test | 640 TO: chef@bork.bork.bork, richard@test |
| 633 Content-Type: text/plain | 641 Content-Type: text/plain |
| 634 Subject: [issue1] Testing... | 642 Subject: [issue1] Testing... |
| 635 To: chef@bork.bork.bork, richard@test | 643 To: chef@bork.bork.bork, richard@test |
| 636 From: mary <issue_tracker@your.tracker.email.domain.example> | 644 From: "mary" <issue_tracker@your.tracker.email.domain.example> |
| 637 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 645 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 638 MIME-Version: 1.0 | 646 MIME-Version: 1.0 |
| 639 Message-Id: <followup_dummy_id> | 647 Message-Id: <followup_dummy_id> |
| 640 In-Reply-To: <dummy_test_message_id> | 648 In-Reply-To: <dummy_test_message_id> |
| 641 X-Roundup-Name: Roundup issue tracker | 649 X-Roundup-Name: Roundup issue tracker |
| 642 Content-Transfer-Encoding: quoted-printable | 650 Content-Transfer-Encoding: quoted-printable |
| 684 '''FROM: roundup-admin@your.tracker.email.domain.example | 692 '''FROM: roundup-admin@your.tracker.email.domain.example |
| 685 TO: chef@bork.bork.bork, richard@test | 693 TO: chef@bork.bork.bork, richard@test |
| 686 Content-Type: text/plain | 694 Content-Type: text/plain |
| 687 Subject: [issue1] Testing... | 695 Subject: [issue1] Testing... |
| 688 To: chef@bork.bork.bork, richard@test | 696 To: chef@bork.bork.bork, richard@test |
| 689 From: mary <issue_tracker@your.tracker.email.domain.example> | 697 From: "mary" <issue_tracker@your.tracker.email.domain.example> |
| 690 Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> | 698 Reply-To: "Roundup issue tracker" <issue_tracker@your.tracker.email.domain.example> |
| 691 MIME-Version: 1.0 | 699 MIME-Version: 1.0 |
| 692 Message-Id: <followup_dummy_id> | 700 Message-Id: <followup_dummy_id> |
| 693 In-Reply-To: <dummy_test_message_id> | 701 In-Reply-To: <dummy_test_message_id> |
| 694 X-Roundup-Name: Roundup issue tracker | 702 X-Roundup-Name: Roundup issue tracker |
| 695 Content-Transfer-Encoding: quoted-printable | 703 Content-Transfer-Encoding: quoted-printable |
| 717 return unittest.TestSuite(l) | 725 return unittest.TestSuite(l) |
| 718 | 726 |
| 719 | 727 |
| 720 # | 728 # |
| 721 # $Log: not supported by cvs2svn $ | 729 # $Log: not supported by cvs2svn $ |
| 730 # Revision 1.20 2002/05/29 01:16:17 richard | |
| 731 # Sorry about this huge checkin! It's fixing a lot of related stuff in one go | |
| 732 # though. | |
| 733 # | |
| 734 # . #541941 ] changing multilink properties by mail | |
| 735 # . #526730 ] search for messages capability | |
| 736 # . #505180 ] split MailGW.handle_Message | |
| 737 # - also changed cgi client since it was duplicating the functionality | |
| 738 # . build htmlbase if tests are run using CVS checkout (removed note from | |
| 739 # installation.txt) | |
| 740 # . don't create an empty message on email issue creation if the email is empty | |
| 741 # | |
| 722 # Revision 1.19 2002/05/23 04:26:05 richard | 742 # Revision 1.19 2002/05/23 04:26:05 richard |
| 723 # 'I must run unit tests before committing\n' * 100 | 743 # 'I must run unit tests before committing\n' * 100 |
| 724 # | 744 # |
| 725 # Revision 1.18 2002/05/15 03:27:16 richard | 745 # Revision 1.18 2002/05/15 03:27:16 richard |
| 726 # . fixed SCRIPT_NAME in ZRoundup for instances not at top level of Zope | 746 # . fixed SCRIPT_NAME in ZRoundup for instances not at top level of Zope |
