diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mail/tests.py | 17 | ||||
-rw-r--r-- | tests/middleware/tests.py | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py index a36c09b369..15593dc3f7 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -991,6 +991,23 @@ class BaseEmailBackendTests(HeadersCheckMixin): mail_managers('hi', 'there') self.assertEqual(self.get_mailbox_content(), []) + def test_wrong_admins_managers(self): + tests = ( + 'test@example.com', + ('test@example.com',), + ['test@example.com', 'other@example.com'], + ('test@example.com', 'other@example.com'), + ) + for setting, mail_func in ( + ('ADMINS', mail_admins), + ('MANAGERS', mail_managers), + ): + msg = 'The %s setting must be a list of 2-tuples.' % setting + for value in tests: + with self.subTest(setting=setting, value=value), self.settings(**{setting: value}): + with self.assertRaisesMessage(ValueError, msg): + mail_func('subject', 'content') + def test_message_cc_header(self): """ Regression test for #7722 diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py index 2da1e11a4e..971fe0a74a 100644 --- a/tests/middleware/tests.py +++ b/tests/middleware/tests.py @@ -340,7 +340,7 @@ class CommonMiddlewareTest(SimpleTestCase): @override_settings( IGNORABLE_404_URLS=[re.compile(r'foo')], - MANAGERS=['PHB@dilbert.com'], + MANAGERS=[('PHD', 'PHB@dilbert.com')], ) class BrokenLinkEmailsMiddlewareTest(SimpleTestCase): |