mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Merge #22215: have the smtplib 'quit' command reset the state.
This commit is contained in:
commit
b10be15508
3 changed files with 23 additions and 0 deletions
|
@ -876,6 +876,21 @@ class SMTPSimTests(unittest.TestCase):
|
|||
str(err))
|
||||
smtp.close()
|
||||
|
||||
def test_quit_resets_greeting(self):
|
||||
smtp = smtplib.SMTP(HOST, self.port,
|
||||
local_hostname='localhost',
|
||||
timeout=15)
|
||||
code, message = smtp.ehlo()
|
||||
self.assertEqual(code, 250)
|
||||
self.assertIn('size', smtp.esmtp_features)
|
||||
smtp.quit()
|
||||
self.assertNotIn('size', smtp.esmtp_features)
|
||||
smtp.connect(HOST, self.port)
|
||||
self.assertNotIn('size', smtp.esmtp_features)
|
||||
smtp.ehlo_or_helo_if_needed()
|
||||
self.assertIn('size', smtp.esmtp_features)
|
||||
smtp.quit()
|
||||
|
||||
def test_with_statement(self):
|
||||
with smtplib.SMTP(HOST, self.port) as smtp:
|
||||
code, message = smtp.noop()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue