forked from GithubBackups/healthchecks
Better formatting for Pushover notifications in log
This commit is contained in:
parent
6d7c885ede
commit
fc415b39c8
@ -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
|
from hc.test import BaseTestCase
|
||||||
|
|
||||||
|
|
||||||
@ -48,3 +48,27 @@ class LogTestCase(BaseTestCase):
|
|||||||
self.client.login(username="charlie@example.org", password="password")
|
self.client.login(username="charlie@example.org", password="password")
|
||||||
r = self.client.get(url)
|
r = self.client.get(url)
|
||||||
assert r.status_code == 403
|
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="alice@example.org", 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="alice@example.org", password="password")
|
||||||
|
r = self.client.get(url)
|
||||||
|
self.assertContains(r, "Called webhook foo/$NAME", status_code=200)
|
||||||
|
@ -93,6 +93,8 @@
|
|||||||
Sent alert to OpsGenie
|
Sent alert to OpsGenie
|
||||||
{% elif event.channel.kind == "hipchat" %}
|
{% elif event.channel.kind == "hipchat" %}
|
||||||
Sent alert to HipChat
|
Sent alert to HipChat
|
||||||
|
{% elif event.channel.kind == "po" %}
|
||||||
|
Sent a Pushover notification
|
||||||
{% elif event.channel.kind == "webhook" %}
|
{% elif event.channel.kind == "webhook" %}
|
||||||
Called webhook {{ event.channel.value_down }}
|
Called webhook {{ event.channel.value_down }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user