diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-07-30 20:59:02 (GMT) |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-07-30 20:59:02 (GMT) |
commit | 5ccc18f29844b55a43bf8f26dffeb39057477dea (patch) | |
tree | cfecef015dc1e93960ef44e2f3a5861998e6a94b /Lib/test/test_imaplib.py | |
parent | 30f1f67248260b10eb16a3e630c6cf5c7e29fad2 (diff) | |
download | cpython-5ccc18f29844b55a43bf8f26dffeb39057477dea.zip cpython-5ccc18f29844b55a43bf8f26dffeb39057477dea.tar.gz cpython-5ccc18f29844b55a43bf8f26dffeb39057477dea.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 | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index b34e652..96b4f32 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -325,6 +325,25 @@ class BaseThreadedNetworkedTests(unittest.TestCase): 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): |