|
|
@ -1,4 +1,4 @@ |
|
|
|
from hc.api.models import Check, Ping |
|
|
|
from hc.api.models import Channel, Check, Notification, Ping |
|
|
|
from hc.test import BaseTestCase |
|
|
|
|
|
|
|
|
|
|
@ -48,3 +48,27 @@ class LogTestCase(BaseTestCase): |
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
r = self.client.get(url) |
|
|
|
assert r.status_code == 403 |
|
|
|
|
|
|
|
def test_it_shows_pushover_notifications(self): |
|
|
|
ch = Channel(kind="po", user=self.alice) |
|
|
|
ch.save() |
|
|
|
|
|
|
|
Notification(owner=self.check, channel=ch, check_status="down").save() |
|
|
|
|
|
|
|
url = "/checks/%s/log/" % self.check.code |
|
|
|
|
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
r = self.client.get(url) |
|
|
|
self.assertContains(r, "Sent a Pushover notification", status_code=200) |
|
|
|
|
|
|
|
def test_it_shows_webhook_notifications(self): |
|
|
|
ch = Channel(kind="webhook", user=self.alice, value="foo/$NAME") |
|
|
|
ch.save() |
|
|
|
|
|
|
|
Notification(owner=self.check, channel=ch, check_status="down").save() |
|
|
|
|
|
|
|
url = "/checks/%s/log/" % self.check.code |
|
|
|
|
|
|
|
self.client.login(username="[email protected]", password="password") |
|
|
|
r = self.client.get(url) |
|
|
|
self.assertContains(r, "Called webhook foo/$NAME", status_code=200) |