mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	Since FIXTURE_DIR_NAME is the name of the folder that contains the view and tests modules of the webhook and another folder called "fixtures" that store the fixtures, it is more appropriate to call it WEBHOOK_DIR_NAME, especially when we want to refer to the view module using this variable.
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
from zerver.lib.test_classes import WebhookTestCase
 | 
						|
 | 
						|
 | 
						|
class PingdomHookTests(WebhookTestCase):
 | 
						|
    STREAM_NAME = "pingdom"
 | 
						|
    URL_TEMPLATE = "/api/v1/external/pingdom?stream={stream}&api_key={api_key}"
 | 
						|
    WEBHOOK_DIR_NAME = "pingdom"
 | 
						|
 | 
						|
    def test_pingdom_from_up_to_down_http_check_message(self) -> None:
 | 
						|
        """
 | 
						|
        Tests if pingdom http check from up to down is handled correctly
 | 
						|
        """
 | 
						|
        expected_message = "Service someurl.com changed its HTTP status from UP to DOWN:\n\n``` quote\nNon-recoverable failure in name resolution\n```"
 | 
						|
        self.check_webhook("http_up_to_down", "Test check status.", expected_message)
 | 
						|
 | 
						|
    def test_pingdom_from_up_to_down_smtp_check_message(self) -> None:
 | 
						|
        """
 | 
						|
        Tests if pingdom smtp check from up to down is handled correctly
 | 
						|
        """
 | 
						|
        expected_message = "Service smtp.someurl.com changed its SMTP status from UP to DOWN:\n\n``` quote\nConnection refused\n```"
 | 
						|
        self.check_webhook("smtp_up_to_down", "SMTP check status.", expected_message)
 | 
						|
 | 
						|
    def test_pingdom_from_up_to_down_imap_check_message(self) -> None:
 | 
						|
        """
 | 
						|
        Tests if pingdom imap check from up to down is handled correctly
 | 
						|
        """
 | 
						|
        expected_message = "Service imap.someurl.com changed its IMAP status from UP to DOWN:\n\n``` quote\nInvalid hostname, address or socket\n```"
 | 
						|
        self.check_webhook("imap_up_to_down", "IMAP check status.", expected_message)
 | 
						|
 | 
						|
    def test_pingdom_from_down_to_up_imap_check_message(self) -> None:
 | 
						|
        """
 | 
						|
        Tests if pingdom imap check from down to up is handled correctly
 | 
						|
        """
 | 
						|
        expected_message = "Service imap.someurl.com changed its IMAP status from DOWN to UP."
 | 
						|
        self.check_webhook("imap_down_to_up", "IMAP check status.", expected_message)
 |