-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
/
tests.py
31 lines (26 loc) · 1.74 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from typing import Text
from zerver.lib.test_classes import WebhookTestCase
class StatuspageHookTests(WebhookTestCase):
STREAM_NAME = 'statuspage-test'
URL_TEMPLATE = u"/api/v1/external/statuspage?api_key={api_key}"
def test_statuspage_incident(self) -> None:
expected_subject = u"Statuspage"
expected_message = u"Incident Report :\n **Database query delays** \n * State: **identified** \n \
* Description: We just encountered that database queries are timing out resulting in inconvenience \
to our end users...we'll do quick fix latest by tommorow !!!"
self.send_and_test_stream_message('incident_created', expected_subject, expected_message,
content_type="application/x-www-form-urlencoded")
def test_statuspage_incident_update(self) -> None:
expected_subject = u"Statuspage"
expected_message = u"Incident Report :\n **Database query delays** \n * State: **resolved** \n \
* Description: The database issue is resolved."
self.send_and_test_stream_message('incident_update', expected_subject, expected_message,
content_type="application/x-www-form-urlencoded")
def test_statuspage_component(self) -> None:
expected_subject = u"Statuspage"
expected_message = u"Component status changed :\n **Database component** has changed status \
from **operational** to **under_maintenance**"
self.send_and_test_stream_message('component_status_update', expected_subject, expected_message,
content_type="application/x-www-form-urlencoded")
def get_body(self, fixture_name: Text) -> Text:
return self.fixture_data("statuspage", fixture_name, file_type="json")