diff options
author | Richard Jones <richard@commonground.com.au> | 2010-08-04 12:27:36 (GMT) |
---|---|---|
committer | Richard Jones <richard@commonground.com.au> | 2010-08-04 12:27:36 (GMT) |
commit | 6a9e6bbf1a7f2953fef2ebe67c9aac093275e4de (patch) | |
tree | 9c38030471141e6feaf0e1991b0fd7d0ae751a3a /Lib/test/test_smtplib.py | |
parent | 62f68ed31f6ace44f524797787df2eb66ffb306c (diff) | |
download | cpython-6a9e6bbf1a7f2953fef2ebe67c9aac093275e4de.zip cpython-6a9e6bbf1a7f2953fef2ebe67c9aac093275e4de.tar.gz cpython-6a9e6bbf1a7f2953fef2ebe67c9aac093275e4de.tar.bz2 |
fix test_smtplib/test_smtpd collision through pre-loaded reply data in mock_socket
Diffstat (limited to 'Lib/test/test_smtplib.py')
-rw-r--r-- | Lib/test/test_smtplib.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 57faf6e..831f2d7 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -64,17 +64,20 @@ class GeneralTests(unittest.TestCase): smtp.close() def testBasic2(self): + mock_socket.reply_with(b"220 Hola mundo") # connects, include port in host name smtp = smtplib.SMTP("%s:%s" % (HOST, self.port)) smtp.close() def testLocalHostName(self): + mock_socket.reply_with(b"220 Hola mundo") # check that supplied local_hostname is used smtp = smtplib.SMTP(HOST, self.port, local_hostname="testhost") self.assertEqual(smtp.local_hostname, "testhost") smtp.close() def testTimeoutDefault(self): + mock_socket.reply_with(b"220 Hola mundo") self.assertTrue(mock_socket.getdefaulttimeout() is None) mock_socket.setdefaulttimeout(30) self.assertEqual(mock_socket.getdefaulttimeout(), 30) @@ -86,6 +89,7 @@ class GeneralTests(unittest.TestCase): smtp.close() def testTimeoutNone(self): + mock_socket.reply_with(b"220 Hola mundo") self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(30) try: @@ -96,6 +100,7 @@ class GeneralTests(unittest.TestCase): smtp.close() def testTimeoutValue(self): + mock_socket.reply_with(b"220 Hola mundo") smtp = smtplib.SMTP(HOST, self.port, timeout=30) self.assertEqual(smtp.sock.gettimeout(), 30) smtp.close() |