2018-01-29 11:33:21 +01:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
|
|
|
|
|
|
|
class InspingHookTests(WebhookTestCase):
|
2021-02-12 08:20:45 +01:00
|
|
|
STREAM_NAME = "test"
|
2018-03-16 22:53:50 +01:00
|
|
|
URL_TEMPLATE = "/api/v1/external/insping?&api_key={api_key}&stream={stream}"
|
2021-06-26 09:18:33 +02:00
|
|
|
WEBHOOK_DIR_NAME = "insping"
|
2018-01-29 11:33:21 +01:00
|
|
|
|
|
|
|
def test_website_state_available_message(self) -> None:
|
2020-04-09 21:51:58 +02:00
|
|
|
expected_topic = "insping"
|
2019-04-17 21:32:23 +02:00
|
|
|
expected_message = """
|
|
|
|
State changed to **Available**:
|
|
|
|
* **URL**: http://privisus.zulipdev.org:9991
|
|
|
|
* **Response time**: 223 ms
|
|
|
|
* **Timestamp**: Fri Dec 29 17:23:46 2017
|
|
|
|
""".strip()
|
2018-01-29 11:33:21 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"website_state_available",
|
|
|
|
expected_topic,
|
|
|
|
expected_message,
|
|
|
|
content_type="application/x-www-form-urlencoded",
|
|
|
|
)
|
2018-01-29 11:33:21 +01:00
|
|
|
|
|
|
|
def test_website_state_not_responding_message(self) -> None:
|
2020-04-09 21:51:58 +02:00
|
|
|
expected_topic = "insping"
|
2019-04-17 21:32:23 +02:00
|
|
|
expected_message = """
|
|
|
|
State changed to **Not Responding**:
|
|
|
|
* **URL**: http://privisus.zulipdev.org:9991
|
|
|
|
* **Response time**: 942 ms
|
|
|
|
* **Timestamp**: Fri Dec 29 17:13:46 2017
|
|
|
|
""".strip()
|
2018-01-29 11:33:21 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"website_state_not_responding",
|
|
|
|
expected_topic,
|
|
|
|
expected_message,
|
|
|
|
content_type="application/x-www-form-urlencoded",
|
|
|
|
)
|