Browse Source

Better formatting for Pushover notifications in log

pull/109/head
Pēteris Caune 8 years ago
parent
commit
fc415b39c8
2 changed files with 27 additions and 1 deletions
  1. +25
    -1
      hc/front/tests/test_log.py
  2. +2
    -0
      templates/front/log.html

+ 25
- 1
hc/front/tests/test_log.py View File

@ -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)

+ 2
- 0
templates/front/log.html View File

@ -93,6 +93,8 @@
Sent alert to OpsGenie
{% elif event.channel.kind == "hipchat" %}
Sent alert to HipChat
{% elif event.channel.kind == "po" %}
Sent a Pushover notification
{% elif event.channel.kind == "webhook" %}
Called webhook {{ event.channel.value_down }}
{% else %}


Loading…
Cancel
Save