diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-07-30 21:01:38 (GMT) |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-07-30 21:01:38 (GMT) |
commit | 78378e89393b99e20c45cb6131fa9d7fa120baac (patch) | |
tree | 69035e51121127dd66592266c04fea3da0913980 /Lib/test/test_imaplib.py | |
parent | 659fcb0a8dd1c3733c609406522d95aa663f2eaa (diff) | |
parent | 5ccc18f29844b55a43bf8f26dffeb39057477dea (diff) | |
download | cpython-78378e89393b99e20c45cb6131fa9d7fa120baac.zip cpython-78378e89393b99e20c45cb6131fa9d7fa120baac.tar.gz cpython-78378e89393b99e20c45cb6131fa9d7fa120baac.tar.bz2 |
Issue #23779: imaplib raises TypeError if authenticator tries to abort.
Patch from Craig Holmquist.
Diffstat (limited to 'Lib/test/test_imaplib.py')
-rw-r--r-- | Lib/test/test_imaplib.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 80e27f3..8248656 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -419,6 +419,26 @@ class ThreadedNetworkedTests(unittest.TestCase): ret, data = client.login_cram_md5("tim", b"tanstaaftanstaaf") self.assertEqual(ret, "OK") + + @reap_threads + def test_aborted_authentication(self): + + class MyServer(SimpleIMAPHandler): + + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.response = yield + + if self.response == b'*\r\n': + self._send_tagged(tag, 'NO', '[AUTHENTICATIONFAILED] aborted') + else: + self._send_tagged(tag, 'OK', 'MYAUTH successful') + + with self.reaped_pair(MyServer) as (server, client): + with self.assertRaises(imaplib.IMAP4.error): + code, data = client.authenticate('MYAUTH', lambda x: None) + + def test_linetoolong(self): class TooLongHandler(SimpleIMAPHandler): def handle(self): |