2016-09-20 22:51:11 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2016-11-10 19:30:09 +01:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
2016-09-20 22:51:11 +02:00
|
|
|
|
|
|
|
class PingdomHookTests(WebhookTestCase):
|
|
|
|
STREAM_NAME = 'pingdom'
|
|
|
|
URL_TEMPLATE = u"/api/v1/external/pingdom?stream={stream}&api_key={api_key}"
|
|
|
|
FIXTURE_DIR_NAME = 'pingdom'
|
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_pingdom_from_up_to_down_http_check_message(self) -> None:
|
2016-09-20 22:51:11 +02:00
|
|
|
"""
|
|
|
|
Tests if pingdom http check from up to down is handled correctly
|
|
|
|
"""
|
2019-04-17 21:59:11 +02:00
|
|
|
expected_message = u"Service someurl.com changed its HTTP status from UP to DOWN:\n\n``` quote\nNon-recoverable failure in name resolution\n```"
|
2016-09-20 22:51:11 +02:00
|
|
|
self.send_and_test_stream_message('http_up_to_down', u"Test check status.", expected_message)
|
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_pingdom_from_up_to_down_smtp_check_message(self) -> None:
|
2016-09-20 22:51:11 +02:00
|
|
|
"""
|
|
|
|
Tests if pingdom smtp check from up to down is handled correctly
|
|
|
|
"""
|
2019-04-17 21:59:11 +02:00
|
|
|
expected_message = u"Service smtp.someurl.com changed its SMTP status from UP to DOWN:\n\n``` quote\nConnection refused\n```"
|
2016-09-20 22:51:11 +02:00
|
|
|
self.send_and_test_stream_message('smtp_up_to_down', u"SMTP check status.", expected_message)
|
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_pingdom_from_up_to_down_imap_check_message(self) -> None:
|
2016-09-20 22:51:11 +02:00
|
|
|
"""
|
|
|
|
Tests if pingdom imap check from up to down is handled correctly
|
|
|
|
"""
|
2019-04-17 21:59:11 +02:00
|
|
|
expected_message = u"Service imap.someurl.com changed its IMAP status from UP to DOWN:\n\n``` quote\nInvalid hostname, address or socket\n```"
|
2016-09-20 22:51:11 +02:00
|
|
|
self.send_and_test_stream_message('imap_up_to_down', u"IMAP check status.", expected_message)
|
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_pingdom_from_down_to_up_imap_check_message(self) -> None:
|
2016-09-20 22:51:11 +02:00
|
|
|
"""
|
|
|
|
Tests if pingdom imap check from down to up is handled correctly
|
|
|
|
"""
|
|
|
|
expected_message = u"Service imap.someurl.com changed its IMAP status from DOWN to UP."
|
|
|
|
self.send_and_test_stream_message('imap_down_to_up', u"IMAP check status.", expected_message)
|