Browse Source

Don't log delivery notifications for unverified email addresses.

pull/142/head
Pēteris Caune 7 years ago
parent
commit
363f219671
2 changed files with 6 additions and 3 deletions
  1. +3
    -3
      hc/api/tests/test_notify.py
  2. +3
    -0
      hc/api/transports.py

+ 3
- 3
hc/api/tests/test_notify.py View File

@ -162,9 +162,9 @@ class NotifyTestCase(BaseTestCase):
self._setup_data("email", "[email protected]", email_verified=False)
self.channel.notify(self.check)
assert Notification.objects.count() == 1
n = Notification.objects.first()
self.assertEqual(n.error, "Email not verified")
# If an email is not verified, it should be skipped over
# without logging a notification:
self.assertEqual(Notification.objects.count(), 0)
self.assertEqual(len(mail.outbox), 0)
@patch("hc.api.transports.requests.request")


+ 3
- 0
hc/api/transports.py View File

@ -70,6 +70,9 @@ class Email(Transport):
emails.alert(self.channel.value, ctx, headers)
def is_noop(self, check):
return not self.channel.email_verified
class HttpTransport(Transport):


Loading…
Cancel
Save