Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhook tests: Remove needless get_body functions.
Steve Howell6d65af179051
diff --git a/zerver/webhooks/ansibletower/tests.py b/zerver/webhooks/ansibletower/tests.pyindex d3953a6b8d6..4c24cf187fc 100644--- a/zerver/webhooks/ansibletower/tests.py+++ b/zerver/webhooks/ansibletower/tests.py@@ -154,6 +154,3 @@ Job: [#2722 System - Updates - Ubuntu](http://awx.example.co.uk/#/jobs/playbook/"(http://awx.example.co.uk/#/jobs/system/2721) failed.")self.check_webhook("system_job_failed", expected_topic, expected_message)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("ansibletower", fixture_name, file_type="json")diff --git a/zerver/webhooks/appfollow/tests.py b/zerver/webhooks/appfollow/tests.pyindex d1e4a663549..e3526e791b1 100644--- a/zerver/webhooks/appfollow/tests.py+++ b/zerver/webhooks/appfollow/tests.py@@ -5,6 +5,7 @@ from zerver.webhooks.appfollow.view import convert_markdownclass AppFollowHookTests(WebhookTestCase):STREAM_NAME = 'appfollow'URL_TEMPLATE = "/api/v1/external/appfollow?stream={stream}&api_key={api_key}"+ FIXTURE_DIR_NAME = 'appfollow'def test_sample(self) -> None:expected_topic = "Webhook integration was successful."@@ -55,9 +56,6 @@ Acme enables me to manage the flow of information quite well. I only wish I coul)self.URL_TEMPLATE = original_url_template- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("appfollow", fixture_name, file_type="json")-class ConvertMarkdownTest(ZulipTestCase):def test_convert_bold(self) -> None:self.assertEqual(convert_markdown("*test message*"), "**test message**")diff --git a/zerver/webhooks/appveyor/tests.py b/zerver/webhooks/appveyor/tests.pyindex 410a5a4546e..0144181450b 100644--- a/zerver/webhooks/appveyor/tests.py+++ b/zerver/webhooks/appveyor/tests.py@@ -33,6 +33,3 @@ class AppveyorHookTests(WebhookTestCase):""".strip()self.check_webhook("appveyor_build_failure", expected_topic, expected_message)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("appveyor", fixture_name, file_type="json")diff --git a/zerver/webhooks/beeminder/tests.py b/zerver/webhooks/beeminder/tests.pyindex c59da484fd6..9d1dfc3e088 100644--- a/zerver/webhooks/beeminder/tests.py+++ b/zerver/webhooks/beeminder/tests.py@@ -7,6 +7,7 @@ from zerver.lib.test_classes import WebhookTestCaseclass BeeminderHookTests(WebhookTestCase):STREAM_NAME = 'beeminder'URL_TEMPLATE = "/api/v1/external/beeminder?api_key={api_key}&stream={stream}"+ FIXTURE_DIR_NAME = "beeminder"@patch('zerver.webhooks.beeminder.view.time.time')def test_beeminder_derail(self, time: Any) -> None:@@ -36,6 +37,3 @@ You are going to derail from goal **gainweight** in **5.6 hours**. You need **+2self.check_webhook("derail_worried", expected_topic, expected_message, content_type="application/json")-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("beeminder", fixture_name, file_type="json")diff --git a/zerver/webhooks/bitbucket/tests.py b/zerver/webhooks/bitbucket/tests.pyindex bcaf201f730..5a9dfe198d1 100644--- a/zerver/webhooks/bitbucket/tests.py+++ b/zerver/webhooks/bitbucket/tests.py@@ -86,6 +86,3 @@ class BitbucketHookTests(WebhookTestCase):result = self.api_post(self.test_user, self.url, payload, content_type="application/json,")self.assertFalse(check_send_webhook_message_mock.called)self.assert_json_success(result)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data(self.FIXTURE_DIR_NAME, fixture_name)diff --git a/zerver/webhooks/delighted/tests.py b/zerver/webhooks/delighted/tests.pyindex f64216cee07..266eabf161f 100644--- a/zerver/webhooks/delighted/tests.py+++ b/zerver/webhooks/delighted/tests.py@@ -43,6 +43,3 @@ Your service is slow, but nearly flawless! Keep up the good work!expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("delighted", fixture_name, file_type="json")diff --git a/zerver/webhooks/dialogflow/tests.py b/zerver/webhooks/dialogflow/tests.pyindex 22f6d4c5012..74249c8df3a 100644--- a/zerver/webhooks/dialogflow/tests.py+++ b/zerver/webhooks/dialogflow/tests.py@@ -3,6 +3,7 @@ from zerver.lib.test_classes import WebhookTestCaseclass DialogflowHookTests(WebhookTestCase):URL_TEMPLATE = "/api/v1/external/dialogflow?api_key={api_key}&[email protected]"+ FIXTURE_DIR_NAME = "dialogflow"def test_dialogflow_default(self) -> None:self.url = self.build_webhook_url(@@ -39,8 +40,3 @@ class DialogflowHookTests(WebhookTestCase):)expected_message = "DialogFlow couldn't process your query."self.send_and_test_private_message("exception", expected_message)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("dialogflow",- fixture_name,- file_type="json")diff --git a/zerver/webhooks/dropbox/tests.py b/zerver/webhooks/dropbox/tests.pyindex 71f337417a6..f35a4a9f72c 100644--- a/zerver/webhooks/dropbox/tests.py+++ b/zerver/webhooks/dropbox/tests.py@@ -18,9 +18,6 @@ class DropboxHookTests(WebhookTestCase):content_type="application/x-www-form-urlencoded",)- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("dropbox", fixture_name, file_type="json")-def test_verification_request(self) -> None:self.subscribe(self.test_user, self.STREAM_NAME)get_params = {'stream_name': self.STREAM_NAME,diff --git a/zerver/webhooks/flock/tests.py b/zerver/webhooks/flock/tests.pyindex d1051c5899c..02d919fd392 100644--- a/zerver/webhooks/flock/tests.py+++ b/zerver/webhooks/flock/tests.py@@ -4,6 +4,7 @@ from zerver.lib.test_classes import WebhookTestCaseclass FlockHookTests(WebhookTestCase):STREAM_NAME = 'test'URL_TEMPLATE = "/api/v1/external/flock?api_key={api_key}&stream={stream}"+ FIXTURE_DIR_NAME = "flock"def test_flock_message(self) -> None:expected_topic = "Flock notifications"@@ -74,6 +75,3 @@ class FlockHookTests(WebhookTestCase):self.check_webhook("todo", expected_topic, expected_message, content_type="application/json")-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("flock", fixture_name, file_type="json")diff --git a/zerver/webhooks/freshdesk/tests.py b/zerver/webhooks/freshdesk/tests.pyindex c71b6b84496..7745d2c0ec3 100644--- a/zerver/webhooks/freshdesk/tests.py+++ b/zerver/webhooks/freshdesk/tests.py@@ -6,6 +6,7 @@ from zerver.lib.test_classes import WebhookTestCaseclass FreshdeskHookTests(WebhookTestCase):STREAM_NAME = 'freshdesk'URL_TEMPLATE = "/api/v1/external/freshdesk?stream={stream}"+ FIXTURE_DIR_NAME = "freshdesk"def test_ticket_creation(self) -> None:"""@@ -104,6 +105,3 @@ Requester \u2603 Bob <[email protected]> created [ticket #12](http://tes""".strip()self.api_stream_message(self.test_user, "inline_images", expected_topic, expected_message,content_type="application/x-www-form-urlencoded")-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("freshdesk", fixture_name, file_type="json")diff --git a/zerver/webhooks/front/tests.py b/zerver/webhooks/front/tests.pyindex f82ea95a63f..8b06dc62ba4 100644--- a/zerver/webhooks/front/tests.py+++ b/zerver/webhooks/front/tests.py@@ -210,6 +210,3 @@ class FrontHookTests(WebhookTestCase):content_type="application/x-www-form-urlencoded")self.assert_json_error(result, "Unknown webhook request")-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data('front', fixture_name, file_type="json")diff --git a/zerver/webhooks/gocd/tests.py b/zerver/webhooks/gocd/tests.pyindex d14b6ad8a13..996ebe34b8a 100644--- a/zerver/webhooks/gocd/tests.py+++ b/zerver/webhooks/gocd/tests.py@@ -34,6 +34,3 @@ class GocdHookTests(WebhookTestCase):expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("gocd", fixture_name, file_type="json")diff --git a/zerver/webhooks/gosquared/tests.py b/zerver/webhooks/gosquared/tests.pyindex 73c5bff3d1b..0f3619f465e 100644--- a/zerver/webhooks/gosquared/tests.py+++ b/zerver/webhooks/gosquared/tests.py@@ -33,6 +33,3 @@ class GoSquaredHookTests(WebhookTestCase):expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("gosquared", fixture_name, file_type="json")diff --git a/zerver/webhooks/grafana/tests.py b/zerver/webhooks/grafana/tests.pyindex ee1f063d8de..73204310833 100644--- a/zerver/webhooks/grafana/tests.py+++ b/zerver/webhooks/grafana/tests.py@@ -60,6 +60,3 @@ The panel has no data.expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("grafana", fixture_name, file_type="json")diff --git a/zerver/webhooks/greenhouse/tests.py b/zerver/webhooks/greenhouse/tests.pyindex 045a084b79e..485945b6e45 100644--- a/zerver/webhooks/greenhouse/tests.py+++ b/zerver/webhooks/greenhouse/tests.py@@ -72,6 +72,3 @@ New Prospect Application Trisha Troy (ID: 968190), applying for:result = self.client_post(self.url, payload, content_type=self.CONTENT_TYPE)self.assertFalse(check_send_webhook_message_mock.called)self.assert_json_success(result)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("greenhouse", fixture_name, file_type="json")diff --git a/zerver/webhooks/groove/tests.py b/zerver/webhooks/groove/tests.pyindex be9c7efcca8..957bb871695 100644--- a/zerver/webhooks/groove/tests.py+++ b/zerver/webhooks/groove/tests.py@@ -123,6 +123,3 @@ This is a note added to a ticketexpected_message,content_type="application/x-ww-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("groove", fixture_name, file_type="json")diff --git a/zerver/webhooks/harbor/tests.py b/zerver/webhooks/harbor/tests.pyindex 30dac486464..4667f717a64 100644--- a/zerver/webhooks/harbor/tests.py+++ b/zerver/webhooks/harbor/tests.py@@ -6,6 +6,7 @@ from zerver.lib.test_classes import WebhookTestCaseclass HarborHookTests(WebhookTestCase):STREAM_NAME = "harbor"URL_TEMPLATE = "/api/v1/external/harbor?api_key={api_key}&stream={stream}"+ FIXTURE_DIR_NAME = "harbor"def test_push_image(self) -> None:expected_topic = "example/test"@@ -35,6 +36,3 @@ Image scan completed for `example/test:latest`. Vulnerabilities by severity:""".strip()self.check_webhook("scanning_completed", expected_topic, expected_message)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("harbor", fixture_name, file_type="json")diff --git a/zerver/webhooks/helloworld/tests.py b/zerver/webhooks/helloworld/tests.pyindex 6861a6c8a18..283f619df41 100644--- a/zerver/webhooks/helloworld/tests.py+++ b/zerver/webhooks/helloworld/tests.py@@ -8,7 +8,7 @@ class HelloWorldHookTests(WebhookTestCase):STREAM_NAME = 'test'URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}"PM_URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}"- FIXTURE_DIR_NAME = 'hello'+ FIXTURE_DIR_NAME = "helloworld"# Note: Include a test function per each distinct message condition your integration supportsdef test_hello_message(self) -> None:@@ -66,6 +66,3 @@ class HelloWorldHookTests(WebhookTestCase):expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("helloworld", fixture_name, file_type="json")diff --git a/zerver/webhooks/homeassistant/tests.py b/zerver/webhooks/homeassistant/tests.pyindex 9e8e4d7397a..edd1f93ad97 100644--- a/zerver/webhooks/homeassistant/tests.py+++ b/zerver/webhooks/homeassistant/tests.py@@ -27,6 +27,3 @@ class HomeAssistantHookTests(WebhookTestCase):expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("homeassistant", fixture_name, file_type="json")diff --git a/zerver/webhooks/insping/tests.py b/zerver/webhooks/insping/tests.pyindex 1e52c367604..4c3daab47f4 100644--- a/zerver/webhooks/insping/tests.py+++ b/zerver/webhooks/insping/tests.py@@ -37,6 +37,3 @@ State changed to **Not Responding**:expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("insping", fixture_name, file_type="json")diff --git a/zerver/webhooks/intercom/tests.py b/zerver/webhooks/intercom/tests.pyindex 1aa7775da7a..84d5b37f06a 100644--- a/zerver/webhooks/intercom/tests.py+++ b/zerver/webhooks/intercom/tests.py@@ -219,6 +219,3 @@ New user created:self.check_webhook("user_unsubscribed", "Contact: Eeshan Garg", "User unsubscribed from emails.",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data('intercom', fixture_name, file_type="json")diff --git a/zerver/webhooks/jira/tests.py b/zerver/webhooks/jira/tests.pyindex 61932673185..f0a68231f5e 100644--- a/zerver/webhooks/jira/tests.py+++ b/zerver/webhooks/jira/tests.py@@ -7,6 +7,7 @@ from zerver.lib.users import get_api_keyclass JiraHookTests(WebhookTestCase):STREAM_NAME = 'jira'URL_TEMPLATE = "/api/v1/external/jira?api_key={api_key}&stream={stream}"+ FIXTURE_DIR_NAME = "jira"def test_custom_stream(self) -> None:api_key = get_api_key(self.test_user)@@ -193,9 +194,6 @@ Adding a comment. Oh, what a comment it is!self.check_webhook("change_status_v1", expected_topic, expected_message)self.check_webhook("change_status_v2", expected_topic, expected_message)- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data('jira', fixture_name)-def test_comment_event_comment_created(self) -> None:expected_topic = "SP-1: Add support for newer format Jira issue comment events"expected_message = """Hemanth V. Alluri commented on issue: *"Add support for newer format Jira issue comment events"*\n``` quote\nSounds like it’s pretty important. I’ll get this fixed ASAP!\n```"""diff --git a/zerver/webhooks/mention/tests.py b/zerver/webhooks/mention/tests.pyindex 0d6765c4522..3aa76e3f1f6 100644--- a/zerver/webhooks/mention/tests.py+++ b/zerver/webhooks/mention/tests.py@@ -24,6 +24,3 @@ Children up and down the country are \u2026expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("mention", fixture_name, file_type="json")diff --git a/zerver/webhooks/netlify/tests.py b/zerver/webhooks/netlify/tests.pyindex 6ef04a71311..aac0c807bd5 100644--- a/zerver/webhooks/netlify/tests.py+++ b/zerver/webhooks/netlify/tests.py@@ -51,6 +51,3 @@ class NetlifyHookTests(WebhookTestCase):self.check_webhook("deploy_unlocked", expected_topic, expected_message, content_type="application/json")-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("netlify", fixture_name, file_type="json")diff --git a/zerver/webhooks/opsgenie/tests.py b/zerver/webhooks/opsgenie/tests.pyindex ccb0d29b44d..55033555536 100644--- a/zerver/webhooks/opsgenie/tests.py+++ b/zerver/webhooks/opsgenie/tests.py@@ -232,6 +232,3 @@ class OpsGenieHookTests(WebhookTestCase):expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("opsgenie", fixture_name, file_type="json")diff --git a/zerver/webhooks/raygun/tests.py b/zerver/webhooks/raygun/tests.pyindex 7a7a47d0248..b14d5a42872 100644--- a/zerver/webhooks/raygun/tests.py+++ b/zerver/webhooks/raygun/tests.py@@ -130,6 +130,3 @@ New [Error](http://app.raygun.io/error-url) occurred:expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("raygun", fixture_name, file_type="json")diff --git a/zerver/webhooks/semaphore/tests.py b/zerver/webhooks/semaphore/tests.pyindex 0e9d9846e3a..8ea4075b2c8 100644--- a/zerver/webhooks/semaphore/tests.py+++ b/zerver/webhooks/semaphore/tests.py@@ -8,6 +8,7 @@ from zerver.lib.test_classes import WebhookTestCaseclass SemaphoreHookTests(WebhookTestCase):STREAM_NAME = 'semaphore'URL_TEMPLATE = "/api/v1/external/semaphore?stream={stream}&api_key={api_key}"+ FIXTURE_DIR_NAME = "semaphore"# Messages are generated by Semaphore on git push. The subject lines below# contain information on the repo and branch, and the message has links and@@ -126,9 +127,6 @@ class SemaphoreHookTests(WebhookTestCase):"tag", expected_topic, expected_message, content_type="application/json")- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("semaphore", fixture_name, file_type="json")-def get_unknown_event(self, fixture_name: str) -> str:"""Return modified payload with revision.reference_type changed"""fixture_data = orjson.loads(self.webhook_fixture_data("semaphore", fixture_name, file_type="json"))diff --git a/zerver/webhooks/solano/tests.py b/zerver/webhooks/solano/tests.pyindex 50a7f5b4870..684e817b0d5 100644--- a/zerver/webhooks/solano/tests.py+++ b/zerver/webhooks/solano/tests.py@@ -73,6 +73,3 @@ Build update (see [build log](https://ci.solanolabs.com:443/reports/3317799)):expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data(self.FIXTURE_DIR_NAME, fixture_name, file_type="json")diff --git a/zerver/webhooks/splunk/tests.py b/zerver/webhooks/splunk/tests.pyindex e6a57349574..9945fc30e73 100644--- a/zerver/webhooks/splunk/tests.py+++ b/zerver/webhooks/splunk/tests.py@@ -165,6 +165,3 @@ Splunk alert from saved search:expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("splunk", fixture_name, file_type="json")diff --git a/zerver/webhooks/statuspage/tests.py b/zerver/webhooks/statuspage/tests.pyindex aed55bf0576..0a82ac683eb 100644--- a/zerver/webhooks/statuspage/tests.py+++ b/zerver/webhooks/statuspage/tests.py@@ -4,6 +4,7 @@ from zerver.lib.test_classes import WebhookTestCaseclass StatuspageHookTests(WebhookTestCase):STREAM_NAME = 'statuspage-test'URL_TEMPLATE = "/api/v1/external/statuspage?api_key={api_key}&stream={stream}"+ FIXTURE_DIR_NAME = "statuspage"def test_statuspage_incident(self) -> None:expected_topic = "Database query delays: All Systems Operational"@@ -42,6 +43,3 @@ class StatuspageHookTests(WebhookTestCase):expected_message,content_type="application/x-www-form-urlencoded",)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("statuspage", fixture_name, file_type="json")diff --git a/zerver/webhooks/zabbix/tests.py b/zerver/webhooks/zabbix/tests.pyindex 28bc6c8b39d..77166be940e 100644--- a/zerver/webhooks/zabbix/tests.py+++ b/zerver/webhooks/zabbix/tests.py@@ -34,6 +34,3 @@ class ZabbixHookTests(WebhookTestCase):msg = self.get_last_message()self.assertEqual(msg.content, expected_message)self.assertEqual(msg.recipient.type, Recipient.PERSONAL)-- def get_body(self, fixture_name: str) -> str:- return self.webhook_fixture_data("zabbix", fixture_name, file_type="json")