send_test_email: Throw an error if email not configured.

This should help minimize confusion when folks try to use this before
properly configuring outgoing email.

Thanks to Bruce Eckel for the report.
This commit is contained in:
Tim Abbott
2018-05-14 12:01:48 -07:00
parent 2cca5dc79f
commit a2ed06314d
2 changed files with 10 additions and 0 deletions

View File

@@ -28,6 +28,11 @@ class TestCheckConfig(ZulipTestCase):
with self.assertRaisesRegex(CommandError, "Error: You must set asdf in /etc/zulip/settings.py."):
check_config()
@override_settings(WARN_NO_EMAIL=True)
def test_check_send_email(self) -> None:
with self.assertRaisesRegex(CommandError, "Outgoing email not yet configured, see"):
call_command("send_test_email", 'test@example.com')
class TestZulipBaseCommand(ZulipTestCase):
def setUp(self) -> None:
self.zulip_realm = get_realm("zulip")