MCPcopy Index your code
hub / github.com/python/cpython / test_421_from_mail_cmd

Method test_421_from_mail_cmd

Lib/test/test_smtplib.py:1300–1308  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1298
1299 # Issue 5713: make sure close, not rset, is called if we get a 421 error
1300 def test_421_from_mail_cmd(self):
1301 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
1302 timeout=support.LOOPBACK_TIMEOUT)
1303 smtp.noop()
1304 self.serv._SMTPchannel.mail_response = '421 closing connection'
1305 with self.assertRaises(smtplib.SMTPSenderRefused):
1306 smtp.sendmail('John', 'Sally', 'test message')
1307 self.assertIsNone(smtp.sock)
1308 self.assertEqual(self.serv._SMTPchannel.rset_count, 0)
1309
1310 def test_421_from_rcpt_cmd(self):
1311 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',

Callers

nothing calls this directly

Calls 5

noopMethod · 0.95
sendmailMethod · 0.95
assertIsNoneMethod · 0.80
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected