Skip to content

Commit

Permalink
Ensure we report errors when email report is enabled but not properly…
Browse files Browse the repository at this point in the history
… configured
  • Loading branch information
amol- committed Feb 11, 2020
1 parent cbaba33 commit 39a63b1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/test_errorware.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,22 @@ def test_enable_true(self):
assert not app.reporters

def test_enable_email(self):
app = self._make(error_email='user@somedomain.com')
app = self._make(error_email='user@somedomain.com',
smtp_server="fakeserver",
from_address="fakesender")
assert app.__class__.__name__ == self.middleware_name
assert any(r.__class__.__name__ == 'EmailReporter'
for r in app.reporters)

def test_enable_email_requires_options(self):
try:
app = self._make(error_email='user@somedomain.com',
from_address="fakesender")
except ValueError as e:
assert "smtp_server" in str(e)
else:
assert False, "not raised"

def test_enable_sentry(self):
app = self._make(sentry_dsn='http://public:secret@example.com/1')
assert app.__class__.__name__ == self.middleware_name
Expand Down Expand Up @@ -105,7 +116,8 @@ def test_enable_without_reporter(self):
assert not app.reporters

def test_enable_email(self):
app = self._make(enable=True, error_email='user@somedomain.com')
app = self._make(enable=True, error_email='user@somedomain.com',
smtp_server="fakesmtp", from_address="fakefrom")
assert app.__class__.__name__ == self.middleware_name
assert any(r.__class__.__name__ == 'EmailReporter'
for r in app.reporters)
Expand Down

0 comments on commit 39a63b1

Please sign in to comment.