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

Method test_aborted_authentication

Lib/test/test_imaplib.py:481–496  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

479 client.login_cram_md5("tim", b"tanstaaftanstaaf")
480
481 def test_aborted_authentication(self):
482 class MyServer(SimpleIMAPHandler):
483 def cmd_AUTHENTICATE(self, tag, args):
484 self._send_textline('+')
485 self.response = yield
486 if self.response == b'*\r\n':
487 self._send_tagged(
488 tag,
489 'NO',
490 '[AUTHENTICATIONFAILED] aborted')
491 else:
492 self._send_tagged(tag, 'OK', 'MYAUTH successful')
493 client, _ = self._setup(MyServer)
494 with self.assertRaisesRegex(imaplib.IMAP4.error,
495 r'\[AUTHENTICATIONFAILED\] aborted'):
496 client.authenticate('MYAUTH', lambda x: None)
497
498 @mock.patch('imaplib._MAXLINE', 10)
499 def test_linetoolong(self):

Callers

nothing calls this directly

Calls 3

_setupMethod · 0.95
assertRaisesRegexMethod · 0.80
authenticateMethod · 0.80

Tested by

no test coverage detected