summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-01-03 20:41:45 +0100
committerClaude Paroz <claude@2xlibre.net>2013-01-03 20:45:57 +0100
commit5b8c0d22cc07ca727c032edf3309fab9cb39f21d (patch)
tree2d7c8c9b44b80aaf536d0a26b25bbb8ca4e85fc1 /tests/regressiontests
parent4081042ef51c0e679c78f2d0d13514af3434ed13 (diff)
[1.5.x] Fixed #19382 -- Stopped smtp backend raising exception when already closed
Thanks Sebastian Noack for the report and the initial patch. Backport of ffa50ca35 from master.
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/mail/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/mail/tests.py b/tests/regressiontests/mail/tests.py
index 9ab8c2c301..059dd6d09a 100644
--- a/tests/regressiontests/mail/tests.py
+++ b/tests/regressiontests/mail/tests.py
@@ -492,6 +492,16 @@ class BaseEmailBackendTests(object):
self.assertEqual(message.get('from'), "tester")
self.assertEqual(message.get('to'), "django")
+ def test_close_connection(self):
+ """
+ Test that connection can be closed (even when not explicitely opened)
+ """
+ conn = mail.get_connection(username='', password='')
+ try:
+ conn.close()
+ except Exception as e:
+ self.fail("close() unexpectedly raised an exception: %s" % e)
+
class LocmemBackendTests(BaseEmailBackendTests, TestCase):
email_backend = 'django.core.mail.backends.locmem.EmailBackend'