summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-07-03 17:56:05 +0000
committerJannis Leidel <jannis@leidel.info>2011-07-03 17:56:05 +0000
commit3bd23ee96fdff0572568eaa42d69c1ce2e46cc18 (patch)
tree85f1dd0e83c16886441be419d25358ff5de4735a /tests
parent1d270ac8a34b9a1f562d2e46411121499caa6e41 (diff)
Fixed #15750 -- Handle empty mail server credentials gracefully. Thanks, LeandroSouza and bedmondmark.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16494 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/mail/tests.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/regressiontests/mail/tests.py b/tests/regressiontests/mail/tests.py
index 5d5f52b6cd..08eb7b9f45 100644
--- a/tests/regressiontests/mail/tests.py
+++ b/tests/regressiontests/mail/tests.py
@@ -635,3 +635,24 @@ class SMTPBackendTests(BaseEmailBackendTests, TestCase):
def get_mailbox_content(self):
return self.server.get_sink()
+
+ @override_settings(EMAIL_HOST_USER="not empty username",
+ EMAIL_HOST_PASSWORD="not empty password")
+ def test_email_authentication_use_settings(self):
+ backend = smtp.EmailBackend()
+ self.assertEqual(backend.username, 'not empty username')
+ self.assertEqual(backend.password, 'not empty password')
+
+ @override_settings(EMAIL_HOST_USER="not empty username",
+ EMAIL_HOST_PASSWORD="not empty password")
+ def test_email_authentication_override_settings(self):
+ backend = smtp.EmailBackend(username='username', password='password')
+ self.assertEqual(backend.username, 'username')
+ self.assertEqual(backend.password, 'password')
+
+ @override_settings(EMAIL_HOST_USER="not empty username",
+ EMAIL_HOST_PASSWORD="not empty password")
+ def test_email_disabled_authentication(self):
+ backend = smtp.EmailBackend(username='', password='')
+ self.assertEqual(backend.username, '')
+ self.assertEqual(backend.password, '')