MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_login_cram_md5

Method test_login_cram_md5

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

Source from the content-addressed store, hash-verified

985 @threading_helper.reap_threads
986 @hashlib_helper.requires_hashdigest('md5', openssl=True)
987 def test_login_cram_md5(self):
988
989 class AuthHandler(SimpleIMAPHandler):
990
991 capabilities = 'LOGINDISABLED AUTH=CRAM-MD5'
992
993 def cmd_AUTHENTICATE(self, tag, args):
994 self._send_textline('+ PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2Uucm'
995 'VzdG9uLm1jaS5uZXQ=')
996 r = yield
997 if (r == b'dGltIGYxY2E2YmU0NjRiOWVmYT'
998 b'FjY2E2ZmZkNmNmMmQ5ZjMy\r\n'):
999 self._send_tagged(tag, 'OK', 'CRAM-MD5 successful')
1000 else:
1001 self._send_tagged(tag, 'NO', 'No access')
1002
1003 with self.reaped_pair(AuthHandler) as (server, client):
1004 self.assertTrue('AUTH=CRAM-MD5' in client.capabilities)
1005 ret, data = client.login_cram_md5("tim", "tanstaaftanstaaf")
1006 self.assertEqual(ret, "OK")
1007
1008 with self.reaped_pair(AuthHandler) as (server, client):
1009 self.assertTrue('AUTH=CRAM-MD5' in client.capabilities)
1010 ret, data = client.login_cram_md5("tim", b"tanstaaftanstaaf")
1011 self.assertEqual(ret, "OK")
1012
1013
1014 @threading_helper.reap_threads

Callers

nothing calls this directly

Calls 4

reaped_pairMethod · 0.95
assertTrueMethod · 0.80
login_cram_md5Method · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected