mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
tests: Add a test for fixtures for non-webhook integrations.
This commit create a directory to store the mock message for nagios and more will be added. The json files in this directory will be used to config the screenshot generating script for the documentations of non-webhook integrations.
This commit is contained in:
4
zerver/integration_fixtures/nagios/service_notify.json
Normal file
4
zerver/integration_fixtures/nagios/service_notify.json
Normal file
@@ -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"
|
||||
}
|
@@ -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")],
|
||||
|
@@ -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(
|
||||
|
Reference in New Issue
Block a user