mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Added test for the sendtestemail command when no recipients are given.
This commit is contained in:
parent
e412d85b46
commit
a702a0773d
@ -1,5 +1,5 @@
|
||||
from django.core import mail
|
||||
from django.core.management import call_command
|
||||
from django.core.management import CommandError, call_command
|
||||
from django.test import SimpleTestCase, override_settings
|
||||
|
||||
|
||||
@ -46,6 +46,18 @@ class SendTestEmailManagementCommand(SimpleTestCase):
|
||||
],
|
||||
)
|
||||
|
||||
def test_missing_receivers(self):
|
||||
"""
|
||||
The command should complain if no receivers are given (and --admins or
|
||||
--managers are not set).
|
||||
"""
|
||||
msg = (
|
||||
"You must specify some email recipients, or pass the --managers or "
|
||||
"--admin options."
|
||||
)
|
||||
with self.assertRaisesMessage(CommandError, msg):
|
||||
call_command("sendtestemail")
|
||||
|
||||
def test_manager_receivers(self):
|
||||
"""
|
||||
The mail should be sent to the email addresses specified in
|
||||
|
Loading…
Reference in New Issue
Block a user