Home | History | Annotate | Download | only in test

Lines Matching refs:smtp

65         smtp = smtplib.SMTP(HOST, self.port)
66 smtp.close()
70 smtp = smtplib.SMTP("%s:%s" % (HOST, self.port))
71 smtp.close()
75 smtp = smtplib.SMTP(HOST, self.port, local_hostname="testhost")
76 self.assertEqual(smtp.local_hostname, "testhost")
77 smtp.close()
83 smtp = smtplib.SMTP(HOST, self.port)
86 self.assertEqual(smtp.sock.gettimeout(), 30)
87 smtp.close()
93 smtp = smtplib.SMTP(HOST, self.port, timeout=None)
96 self.assertTrue(smtp.sock.gettimeout() is None)
97 smtp.close()
100 smtp = smtplib.SMTP(HOST, self.port, timeout=30)
101 self.assertEqual(smtp.sock.gettimeout(), 30)
102 smtp.close()
105 # Test server thread using the specified SMTP server class
140 # NOTE: Some SMTP objects in the tests below are created with a non-default
182 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
183 smtp.quit()
186 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
188 self.assertEqual(smtp.noop(), expected)
189 smtp.quit()
192 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
194 self.assertEqual(smtp.rset(), expected)
195 smtp.quit()
199 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
201 self.assertEqual(smtp.ehlo(), expected)
202 smtp.quit()
206 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
208 self.assertEqual(smtp.vrfy('nobody@nowhere.com'), expected)
209 self.assertEqual(smtp.verify('nobody@nowhere.com'), expected)
210 smtp.quit()
215 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
216 smtp.helo()
218 self.assertEqual(smtp.helo(), expected)
219 smtp.quit()
222 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
223 self.assertEqual(smtp.help(), 'Error: command "HELP" not implemented')
224 smtp.quit()
229 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
230 smtp.sendmail('John', 'Sally', m)
235 smtp.quit()
247 # Test various operations on an unconnected SMTP object that
248 # should raise exceptions (at present the attempt in SMTP.send
249 # to reference the nonexistent 'sock' attribute of the SMTP object
251 smtp = smtplib.SMTP()
252 self.assertRaises(smtplib.SMTPServerDisconnected, smtp.ehlo)
254 smtp.send, 'test msg')
258 self.assertRaises(socket.error, smtplib.SMTP,
260 self.assertRaises(socket.error, smtplib.SMTP,
291 self.assertRaises(smtplib.SMTPConnectError, smtplib.SMTP,
315 # Simulated SMTP channel & server
393 # Test various SMTP & ESMTP commands/behaviors that require a simulated server
424 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
425 smtp.quit()
428 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
431 self.assertEqual(smtp.esmtp_features, {})
441 smtp.ehlo()
442 self.assertEqual(smtp.esmtp_features, expected_features)
444 self.assertTrue(smtp.has_extn(k))
445 self.assertFalse(smtp.has_extn('unsupported-feature'))
446 smtp.quit()
449 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
453 self.assertEqual(smtp.vrfy(email), expected_known)
457 self.assertEqual(smtp.vrfy(u), expected_unknown)
458 smtp.quit()
461 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
468 self.assertEqual(smtp.expn(listname), expected_known)
472 self.assertEqual(smtp.expn(u), expected_unknown)
473 smtp.quit()
477 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
480 self.assertEqual(smtp.login(sim_auth[0], sim_auth[1]), expected_auth_ok)
492 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
493 try: smtp.login(sim_auth[0], sim_auth[1])
500 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
502 try: smtp.login(sim_auth[0], sim_auth[1])