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

Method testAUTH_CRAM_MD5_blocked

Lib/test/test_smtplib.py:1190–1201  ·  view source on GitHub ↗
(self, hmac_constructor)

Source from the content-addressed store, hash-verified

1188 @mock.patch("hmac.HMAC")
1189 @mock.patch("smtplib._have_cram_md5_support", False)
1190 def testAUTH_CRAM_MD5_blocked(self, hmac_constructor):
1191 # CRAM-MD5 is the only "known" method by the server,
1192 # but it is not supported by the client. In particular,
1193 # no challenge will ever be sent.
1194 self.serv.add_feature("AUTH CRAM-MD5")
1195 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
1196 timeout=support.LOOPBACK_TIMEOUT)
1197 self.addCleanup(smtp.close)
1198 msg = re.escape("No suitable authentication method found.")
1199 with self.assertRaisesRegex(smtplib.SMTPException, msg):
1200 smtp.login(sim_auth[0], sim_auth[1])
1201 hmac_constructor.assert_not_called() # call has been bypassed
1202
1203 @mock.patch("smtplib._have_cram_md5_support", False)
1204 def testAUTH_CRAM_MD5_blocked_and_fallback(self):

Callers

nothing calls this directly

Calls 6

loginMethod · 0.95
add_featureMethod · 0.80
addCleanupMethod · 0.80
escapeMethod · 0.80
assertRaisesRegexMethod · 0.80
assert_not_calledMethod · 0.80

Tested by

no test coverage detected