Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tests: Add a test for fixtures for non-webhook integrations.
PIG208d20deccee7a8
diff --git a/zerver/integration_fixtures/nagios/service_notify.json b/zerver/integration_fixtures/nagios/service_notify.jsonnew file mode 100644index 00000000000..722a7aaeabd--- /dev/null+++ b/zerver/integration_fixtures/nagios/service_notify.json@@ -0,0 +1,4 @@+{+ "subject": "service remote load on postgres.humbughq.com",+ "body": "**PROBLEM**: service is CRITICAL\n> CRITICAL - load average: 7.49, 8.20, 4.72"+}diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.pyindex 0a84a64ffa5..820df79f98c 100644--- a/zerver/lib/integrations.py+++ b/zerver/lib/integrations.py@@ -741,6 +741,7 @@ DOC_SCREENSHOT_CONFIG: Dict[str, List[BaseScreenshotConfig]] = {"json": [ScreenshotConfig("json_github_push__1_commit.json")],"librato": [ScreenshotConfig("three_conditions_alert.json", payload_as_query_param=True)],"mention": [ScreenshotConfig("webfeeds.json")],+ "nagios": [BaseScreenshotConfig("service_notify.json")],"netlify": [ScreenshotConfig("deploy_building.json")],"newrelic": [ScreenshotConfig("alert.txt", "002.png")],"opbeat": [ScreenshotConfig("error_reopen.json")],diff --git a/zerver/tests/test_integrations.py b/zerver/tests/test_integrations.pyindex 342af981a1f..f2ae81fb5f3 100644--- a/zerver/tests/test_integrations.py+++ b/zerver/tests/test_integrations.py@@ -3,6 +3,8 @@ from zerver.lib.integrations import (INTEGRATIONS,NO_SCREENSHOT_WEBHOOKS,WEBHOOK_INTEGRATIONS,+ BaseScreenshotConfig,+ Integration,ScreenshotConfig,WebhookIntegration,get_fixture_and_image_paths,@@ -26,6 +28,14 @@ class IntegrationsTestCase(ZulipTestCase):self.assertEqual(fixture_path, "zerver/webhooks/airbrake/fixtures/error_message.json")self.assertEqual(image_path, "static/images/integrations/ci/002.png")+ def test_get_fixture_and_image_paths_non_webhook(self) -> None:+ integration = INTEGRATIONS["nagios"]+ assert isinstance(integration, Integration)+ screenshot_config = BaseScreenshotConfig("service_notify.json", "001.png")+ fixture_path, image_path = get_fixture_and_image_paths(integration, screenshot_config)+ self.assertEqual(fixture_path, "zerver/integration_fixtures/nagios/service_notify.json")+ self.assertEqual(image_path, "static/images/integrations/nagios/001.png")+def test_get_bot_avatar_path(self) -> None:integration = INTEGRATIONS["alertmanager"]self.assertEqual(