(self, hmac_constructor)
| 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): |
nothing calls this directly
no test coverage detected