Rev 2340: (Marien Zwart) Override smtplib.connect so we don't require smtpd to be running. in http://bzr.arbash-meinel.com/branches/bzr/jam-integration
John Arbash Meinel
john at arbash-meinel.com
Mon Mar 12 15:56:10 GMT 2007
At http://bzr.arbash-meinel.com/branches/bzr/jam-integration
------------------------------------------------------------
revno: 2340
revision-id: john at arbash-meinel.com-20070312155604-ce341jry03f4w58m
parent: pqm at pqm.ubuntu.com-20070312154217-b0cd137fae2a67d8
parent: marienz at gentoo.org-20070312034818-vxuaptp67gfiv8ym
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Mon 2007-03-12 09:56:04 -0600
message:
(Marien Zwart) Override smtplib.connect so we don't require smtpd to be running.
modified:
bzrlib/tests/blackbox/test_merge_directive.py test_merge_directive-20070302012039-zh7uhy39biairtn0-1
------------------------------------------------------------
revno: 2338.2.1
merged: marienz at gentoo.org-20070312034818-vxuaptp67gfiv8ym
parent: pqm at pqm.ubuntu.com-20070311211206-0fd0176ac1e77ef7
committer: Marien Zwart <marienz at gentoo.org>
branch nick: bzr-mail-test
timestamp: Mon 2007-03-12 04:48:18 +0100
message:
Make the merge directive tests work if there is no smtpd running on localhost.
-------------- next part --------------
=== modified file 'bzrlib/tests/blackbox/test_merge_directive.py'
--- a/bzrlib/tests/blackbox/test_merge_directive.py 2007-03-09 21:51:41 +0000
+++ b/bzrlib/tests/blackbox/test_merge_directive.py 2007-03-12 03:48:18 +0000
@@ -102,15 +102,24 @@
sendmail_calls = []
def sendmail(self, from_, to, message):
sendmail_calls.append((self, from_, to, message))
+ connect_calls = []
+ def connect(self, host='localhost', port=0):
+ connect_calls.append((self, host, port))
old_sendmail = smtplib.SMTP.sendmail
smtplib.SMTP.sendmail = sendmail
+ old_connect = smtplib.SMTP.connect
+ smtplib.SMTP.connect = connect
try:
md_text = self.run_bzr('merge-directive', '--mail-to',
'pqm at example.com', '--plain', '../tree2',
'.')[0]
finally:
smtplib.SMTP.sendmail = old_sendmail
+ smtplib.SMTP.connect = old_connect
self.assertEqual('', md_text)
+ self.assertEqual(1, len(connect_calls))
+ call = connect_calls[0]
+ self.assertEqual(('localhost', 0), call[1:3])
self.assertEqual(1, len(sendmail_calls))
call = sendmail_calls[0]
self.assertEqual(('J. Random Hacker <jrandom at example.com>',
More information about the bazaar-commits
mailing list