mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-36348: IMAP4.logout() doesn't ignore exc (GH-12411)
The imap.IMAP4.logout() method no longer ignores silently arbitrary exceptions. Changes: * The IMAP4.logout() method now expects a "BYE" untagged response, rather than relying on _check_bye() which raises a self.abort() exception. * IMAP4.__exit__() now does nothing if the client already logged out. * Add more debug info if test_logout() tests fail.
This commit is contained in:
parent
0810fa7988
commit
74125a60b7
5 changed files with 28 additions and 13 deletions
|
@ -470,8 +470,8 @@ class NewIMAPTestsMixin():
|
|||
self.assertEqual(typ, 'OK')
|
||||
self.assertEqual(data[0], b'LOGIN completed')
|
||||
typ, data = client.logout()
|
||||
self.assertEqual(typ, 'BYE')
|
||||
self.assertEqual(data[0], b'IMAP4ref1 Server logging out')
|
||||
self.assertEqual(typ, 'BYE', (typ, data))
|
||||
self.assertEqual(data[0], b'IMAP4ref1 Server logging out', (typ, data))
|
||||
self.assertEqual(client.state, 'LOGOUT')
|
||||
|
||||
def test_lsub(self):
|
||||
|
@ -937,7 +937,7 @@ class RemoteIMAPTest(unittest.TestCase):
|
|||
with transient_internet(self.host):
|
||||
rs = self.server.logout()
|
||||
self.server = None
|
||||
self.assertEqual(rs[0], 'BYE')
|
||||
self.assertEqual(rs[0], 'BYE', rs)
|
||||
|
||||
|
||||
@unittest.skipUnless(ssl, "SSL not available")
|
||||
|
@ -995,7 +995,7 @@ class RemoteIMAP_SSLTest(RemoteIMAPTest):
|
|||
with transient_internet(self.host):
|
||||
_server = self.imap_class(self.host, self.port)
|
||||
rs = _server.logout()
|
||||
self.assertEqual(rs[0], 'BYE')
|
||||
self.assertEqual(rs[0], 'BYE', rs)
|
||||
|
||||
def test_ssl_context_certfile_exclusive(self):
|
||||
with transient_internet(self.host):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue