Skip to content

Commit 0a0608c

Browse files
committed
fortify test
1 parent e131e66 commit 0a0608c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

Lib/test/test_smtplib.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,15 @@ def testAUTH_CRAM_MD5_blocked_and_fallback(self):
12071207
smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
12081208
timeout=support.LOOPBACK_TIMEOUT)
12091209
self.addCleanup(smtp.close)
1210-
resp = smtp.login(sim_auth[0], sim_auth[1])
1210+
with (
1211+
mock.patch.object(smtp, "auth_cram_md5") as smtp_auth_cram_md5,
1212+
mock.patch.object(
1213+
smtp, "auth_plain", wraps=smtp.auth_plain
1214+
) as smtp_auth_plain
1215+
):
1216+
resp = smtp.login(sim_auth[0], sim_auth[1])
1217+
smtp_auth_plain.assert_called_once()
1218+
smtp_auth_cram_md5.assert_not_called()
12111219
self.assertEqual(resp, (235, b'Authentication Succeeded'))
12121220

12131221
@hashlib_helper.requires_hashdigest('md5', openssl=True)

0 commit comments

Comments
 (0)