summaryrefslogtreecommitdiff
path: root/Lib/test/test_smtplib.py
diff options
context:
space:
mode:
authorAndrew Kuchling <amk@amk.ca>2013-11-11 14:03:23 -0500
committerAndrew Kuchling <amk@amk.ca>2013-11-11 14:03:23 -0500
commit785918250fc818d83a5bb6e62a3018c67fba76ee (patch)
treeb633e482212f31faf67a34159a3b70cc67fd562e /Lib/test/test_smtplib.py
parentfc0cad8b04b872ab2af7c9c232247513892687c8 (diff)
downloadcpython-git-785918250fc818d83a5bb6e62a3018c67fba76ee.tar.gz
Closes #6683: add a test that exercises multiple authentication.
The SMTP server advertises four different authentication methods, and the code will try CRAM-MD5 first, which will fail, but LOGIN succeeds.
Diffstat (limited to 'Lib/test/test_smtplib.py')
-rw-r--r--Lib/test/test_smtplib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index a501f40b56..e6f39dec77 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -819,6 +819,15 @@ class SMTPSimTests(unittest.TestCase):
self.assertIn(sim_auth_credentials['cram-md5'], str(err))
smtp.close()
+ def testAUTH_multiple(self):
+ # Test that multiple authentication methods are tried.
+ self.serv.add_feature("AUTH BOGUS PLAIN LOGIN CRAM-MD5")
+ smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
+ try: smtp.login(sim_auth[0], sim_auth[1])
+ except smtplib.SMTPAuthenticationError as err:
+ self.assertIn(sim_auth_login_password, str(err))
+ smtp.close()
+
def test_with_statement(self):
with smtplib.SMTP(HOST, self.port) as smtp:
code, message = smtp.noop()