(self)
| 640 | self.assertRegex(debugout, to_addr) |
| 641 | |
| 642 | def testSendMessageResent(self): |
| 643 | m = email.mime.text.MIMEText('A test message') |
| 644 | m['From'] = 'foo@bar.com' |
| 645 | m['To'] = 'John' |
| 646 | m['CC'] = 'Sally, Fred' |
| 647 | m['Bcc'] = 'John Root <root@localhost>, "Dinsdale" <warped@silly.walks.com>' |
| 648 | m['Resent-Date'] = 'Thu, 1 Jan 1970 17:42:00 +0000' |
| 649 | m['Resent-From'] = 'holy@grail.net' |
| 650 | m['Resent-To'] = 'Martha <my_mom@great.cooker.com>, Jeff' |
| 651 | m['Resent-Bcc'] = 'doe@losthope.net' |
| 652 | smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', |
| 653 | timeout=support.LOOPBACK_TIMEOUT) |
| 654 | self.addCleanup(smtp.close) |
| 655 | smtp.send_message(m) |
| 656 | # XXX (see comment in testSend) |
| 657 | time.sleep(0.01) |
| 658 | smtp.quit() |
| 659 | |
| 660 | self.client_evt.set() |
| 661 | self.serv_evt.wait() |
| 662 | self.output.flush() |
| 663 | # The Resent-Bcc headers are deleted before serialization. |
| 664 | del m['Bcc'] |
| 665 | del m['Resent-Bcc'] |
| 666 | # Remove the X-Peer header that DebuggingServer adds. |
| 667 | test_output = self.get_output_without_xpeer() |
| 668 | del m['X-Peer'] |
| 669 | mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) |
| 670 | self.assertEqual(test_output, mexpect) |
| 671 | debugout = smtpd.DEBUGSTREAM.getvalue() |
| 672 | sender = re.compile("^sender: holy@grail.net$", re.MULTILINE) |
| 673 | self.assertRegex(debugout, sender) |
| 674 | for addr in ('my_mom@great.cooker.com', 'Jeff', 'doe@losthope.net'): |
| 675 | to_addr = re.compile(r"^recips: .*'{}'.*$".format(addr), |
| 676 | re.MULTILINE) |
| 677 | self.assertRegex(debugout, to_addr) |
| 678 | |
| 679 | def testSendMessageMultipleResentRaises(self): |
| 680 | m = email.mime.text.MIMEText('A test message') |
nothing calls this directly
no test coverage detected