Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhooks: Make WEBHOOK_DIR_NAME optional in test classes.
Niloth P97efb066ebd0
diff --git a/api_docs/incoming-webhooks-walkthrough.md b/api_docs/incoming-webhooks-walkthrough.mdindex 470d1231bb1..b53c7aff5c0 100644--- a/api_docs/incoming-webhooks-walkthrough.md+++ b/api_docs/incoming-webhooks-walkthrough.md@@ -413,7 +413,6 @@ class HelloWorldHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}"DIRECT_MESSAGE_URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}"- WEBHOOK_DIR_NAME = "helloworld"# Note: Include a test function per each distinct message condition your integration supportsdef test_hello_message(self) -> None:@@ -429,7 +428,7 @@ class HelloWorldHookTests(WebhookTestCase):)```-In the above example, `CHANNEL_NAME`, `URL_TEMPLATE`, and `WEBHOOK_DIR_NAME` refer+In the above example, `CHANNEL_NAME`, and `URL_TEMPLATE` referto class attributes from the base class, `WebhookTestCase`. These are needed bythe helper function `check_webhook` to determine how to executeyour test. `CHANNEL_NAME` should be set to your default channel. If it doesn't exist,diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.pyindex 8a2cf9cd875..f3f1f36d245 100644--- a/zerver/lib/test_classes.py+++ b/zerver/lib/test_classes.py@@ -2460,9 +2460,9 @@ class WebhookTestCase(ZulipTestCase):* Tests can override get_body for cases where there is noavailable fixture file.- * Tests should specify WEBHOOK_DIR_NAME to enforce that all event- types are declared in the @webhook_view decorator. This is- important for ensuring we document all fully supported event types.+ * We enforce that all event types are declared in the @webhook_view+ decorator. This is important for ensuring we document all fully+ supported event types."""CHANNEL_NAME: str | None = None@@ -2470,52 +2470,57 @@ class WebhookTestCase(ZulipTestCase):URL_TEMPLATE: strWEBHOOK_DIR_NAME: str | None = None+ def get_webhook_dir_name(self) -> str:+ module_parts = self.__module__.split(".")+ if len(module_parts) >= 3 and module_parts[0] == "zerver" and module_parts[1] == "webhooks":+ return module_parts[2]+ raise AssertionError(f"Cannot determine webhook directory from module: {self.__module__}")+@overridedef setUp(self) -> None:super().setUp()self.test_user = self.get_user_from_email(self.TEST_USER_EMAIL, get_realm("zulip"))self.url = self.build_webhook_url()+ self.webhook_dir_name = self.WEBHOOK_DIR_NAME or self.get_webhook_dir_name()- if self.WEBHOOK_DIR_NAME is not None:- function = import_string(- f"zerver.webhooks.{self.WEBHOOK_DIR_NAME}.view.api_{self.WEBHOOK_DIR_NAME}_webhook"- )- all_event_types = None-- if hasattr(function, "_all_event_types"):- all_event_types = function._all_event_types-- if all_event_types is None:- return # nocoverage+ function = import_string(+ f"zerver.webhooks.{self.webhook_dir_name}.view.api_{self.webhook_dir_name}_webhook"+ )- def side_effect(*args: Any, **kwargs: Any) -> int | None:- complete_event_type = (- kwargs.get("complete_event_type")- if len(args) < 5- else args[4] # complete_event_type is the argument at index 4- )- if (- complete_event_type is not None- and all_event_types is not None- and complete_event_type not in all_event_types- ): # nocoverage- raise Exception(- f"""+ all_event_types = None+ if hasattr(function, "_all_event_types"):+ all_event_types = function._all_event_types+ if all_event_types is None:+ return # nocoverage++ def side_effect(*args: Any, **kwargs: Any) -> int | None:+ complete_event_type = (+ kwargs.get("complete_event_type")+ if len(args) < 5+ else args[4] # complete_event_type is the argument at index 4+ )+ if (+ complete_event_type is not None+ and all_event_types is not None+ and complete_event_type not in all_event_types+ ): # nocoverage+ raise Exception(+ f"""Error: This test triggered a message using the event "{complete_event_type}", which was not properlyregistered via the @webhook_view(..., event_types=[...]). These registrations are important for Zulipself-documenting the supported event types for this integration.You can fix this by adding "{complete_event_type}" to ALL_EVENT_TYPES for this webhook.""".strip()- )- return check_send_webhook_message(*args, **kwargs)+ )+ return check_send_webhook_message(*args, **kwargs)- self.patch = mock.patch(- f"zerver.webhooks.{self.WEBHOOK_DIR_NAME}.view.check_send_webhook_message",- side_effect=side_effect,- )- self.patch.start()- self.addCleanup(self.patch.stop)+ self.patch = mock.patch(+ f"zerver.webhooks.{self.webhook_dir_name}.view.check_send_webhook_message",+ side_effect=side_effect,+ )+ self.patch.start()+ self.addCleanup(self.patch.stop)def api_channel_message(self,@@ -2572,10 +2577,9 @@ You can fix this by adding "{complete_event_type}" to ALL_EVENT_TYPES for this wpayload = self.get_payload(fixture_name)if content_type is not None:extra["content_type"] = content_type- if self.WEBHOOK_DIR_NAME is not None:- headers = call_fixture_to_headers(self.WEBHOOK_DIR_NAME, fixture_name)- headers = standardize_headers(headers)- extra.update(headers)+ headers = call_fixture_to_headers(self.webhook_dir_name, fixture_name)+ headers = standardize_headers(headers)+ extra.update(headers)try:msg = self.send_webhook_payload(self.test_user,@@ -2638,10 +2642,9 @@ one or more new messages.payload = self.get_payload(fixture_name)extra["content_type"] = content_type- if self.WEBHOOK_DIR_NAME is not None:- headers = call_fixture_to_headers(self.WEBHOOK_DIR_NAME, fixture_name)- headers = standardize_headers(headers)- extra.update(headers)+ headers = call_fixture_to_headers(self.webhook_dir_name, fixture_name)+ headers = standardize_headers(headers)+ extra.update(headers)if sender is None:sender = self.test_user@@ -2684,8 +2687,7 @@ one or more new messages.return self.get_body(fixture_name)def get_body(self, fixture_name: str) -> str:- assert self.WEBHOOK_DIR_NAME is not None- body = self.webhook_fixture_data(self.WEBHOOK_DIR_NAME, fixture_name)+ body = self.webhook_fixture_data(self.webhook_dir_name, fixture_name)# fail fast if we don't have valid jsonorjson.loads(body)return bodydiff --git a/zerver/tests/test_webhooks_common.py b/zerver/tests/test_webhooks_common.pyindex 4bdfe51c4e5..2525af7a637 100644--- a/zerver/tests/test_webhooks_common.py+++ b/zerver/tests/test_webhooks_common.py@@ -241,6 +241,7 @@ class WebhookURLConfigurationTestCase(WebhookTestCase):class MissingEventHeaderTestCase(WebhookTestCase):CHANNEL_NAME = "groove"URL_TEMPLATE = "/api/v1/external/groove?stream={stream}&api_key={api_key}"+ WEBHOOK_DIR_NAME = "groove"# This tests the get_event_header function with an actual webhook,# instead of just making a mockdiff --git a/zerver/webhooks/airbrake/tests.py b/zerver/webhooks/airbrake/tests.pyindex 24b7c659dac..c4bd751b3e6 100644--- a/zerver/webhooks/airbrake/tests.py+++ b/zerver/webhooks/airbrake/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass AirbrakeHookTests(WebhookTestCase):CHANNEL_NAME = "airbrake"URL_TEMPLATE = "/api/v1/external/airbrake?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "airbrake"def test_airbrake_error_message(self) -> None:expected_topic_name = "ZulipIntegrationTest"diff --git a/zerver/webhooks/airbyte/tests.py b/zerver/webhooks/airbyte/tests.pyindex 1a997bc292c..7bca8e6a3b7 100644--- a/zerver/webhooks/airbyte/tests.py+++ b/zerver/webhooks/airbyte/tests.py@@ -6,7 +6,6 @@ class AirbyteHookTests(WebhookTestCase):URL_TEMPLATE = "/api/v1/external/airbyte?api_key={api_key}&stream={stream}"FIXTURE_DIR_NAME = "airbyte"CHANNEL_NAME = "test"- WEBHOOK_DIR_NAME = "airbyte"def test_airbyte_job_success(self) -> None:expected_topic = "Zulip Airbyte Integration - Google Sheets → Postgres"diff --git a/zerver/webhooks/alertmanager/tests.py b/zerver/webhooks/alertmanager/tests.pyindex e395c631a9e..0f6cac4f057 100644--- a/zerver/webhooks/alertmanager/tests.py+++ b/zerver/webhooks/alertmanager/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass AlertmanagerHookTests(WebhookTestCase):CHANNEL_NAME = "alertmanager"URL_TEMPLATE = "/api/v1/external/alertmanager?&api_key={api_key}&stream={stream}&name=topic&desc=description"- WEBHOOK_DIR_NAME = "alertmanager"def test_error_issue_message(self) -> None:expected_topic_name = "andromeda"diff --git a/zerver/webhooks/ansibletower/tests.py b/zerver/webhooks/ansibletower/tests.pyindex a5ab2dd6d41..09e2b96bb8c 100644--- a/zerver/webhooks/ansibletower/tests.py+++ b/zerver/webhooks/ansibletower/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass AnsibletowerHookTests(WebhookTestCase):CHANNEL_NAME = "ansibletower"URL_TEMPLATE = "/api/v1/external/ansibletower?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "ansibletower"def test_ansibletower_project_update_successful_message(self) -> None:"""diff --git a/zerver/webhooks/appfollow/tests.py b/zerver/webhooks/appfollow/tests.pyindex 76146d912ae..87625dd6a04 100644--- a/zerver/webhooks/appfollow/tests.py+++ b/zerver/webhooks/appfollow/tests.py@@ -5,7 +5,6 @@ from zerver.webhooks.appfollow.view import convert_markdownclass AppFollowHookTests(WebhookTestCase):CHANNEL_NAME = "appfollow"URL_TEMPLATE = "/api/v1/external/appfollow?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "appfollow"def test_sample(self) -> None:expected_topic_name = "Webhook integration was successful."diff --git a/zerver/webhooks/appveyor/tests.py b/zerver/webhooks/appveyor/tests.pyindex 12bf2a0449a..4932fb003ad 100644--- a/zerver/webhooks/appveyor/tests.py+++ b/zerver/webhooks/appveyor/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass AppveyorHookTests(WebhookTestCase):CHANNEL_NAME = "appveyor"URL_TEMPLATE = "/api/v1/external/appveyor?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "appveyor"def test_appveyor_build_success_message(self) -> None:"""diff --git a/zerver/webhooks/azuredevops/tests.py b/zerver/webhooks/azuredevops/tests.pyindex 7dfc62fa67a..d9d9d0c8eae 100644--- a/zerver/webhooks/azuredevops/tests.py+++ b/zerver/webhooks/azuredevops/tests.py@@ -7,7 +7,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMITclass AzuredevopsHookTests(WebhookTestCase):CHANNEL_NAME = "azure-devops"URL_TEMPLATE = "/api/v1/external/azuredevops?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "azuredevops"def test_push_event_message(self) -> None:expected_topic_name = "test-zulip / main"diff --git a/zerver/webhooks/basecamp/tests.py b/zerver/webhooks/basecamp/tests.pyindex 53a9782b2b5..3cd1047c7b5 100644--- a/zerver/webhooks/basecamp/tests.py+++ b/zerver/webhooks/basecamp/tests.py@@ -6,7 +6,6 @@ TOPIC_NAME = "Zulip HQ"class BasecampHookTests(WebhookTestCase):CHANNEL_NAME = "basecamp"URL_TEMPLATE = "/api/v1/external/basecamp?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "basecamp"def test_basecamp_makes_doc_active(self) -> None:expected_message = "Tomasz activated the document [Sponsorship Package Outline](https://3.basecamp.com/3688623/buckets/2957043/documents/432522214)."diff --git a/zerver/webhooks/beeminder/tests.py b/zerver/webhooks/beeminder/tests.pyindex a3d34a9abbc..b1bea67176a 100644--- a/zerver/webhooks/beeminder/tests.py+++ b/zerver/webhooks/beeminder/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass BeeminderHookTests(WebhookTestCase):CHANNEL_NAME = "beeminder"URL_TEMPLATE = "/api/v1/external/beeminder?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "beeminder"@patch("zerver.webhooks.beeminder.view.time.time")def test_beeminder_derail(self, time: MagicMock) -> None:diff --git a/zerver/webhooks/bitbucket/tests.py b/zerver/webhooks/bitbucket/tests.pyindex e6ad883c68f..5f639f050d6 100644--- a/zerver/webhooks/bitbucket/tests.py+++ b/zerver/webhooks/bitbucket/tests.py@@ -9,7 +9,6 @@ TOPIC_BRANCH_EVENTS = "Repository name / master"class BitbucketHookTests(WebhookTestCase):CHANNEL_NAME = "bitbucket"URL_TEMPLATE = "/api/v1/external/bitbucket?stream={stream}"- WEBHOOK_DIR_NAME = "bitbucket"def test_bitbucket_on_push_event(self) -> None:fixture_name = "push"diff --git a/zerver/webhooks/bitbucket2/tests.py b/zerver/webhooks/bitbucket2/tests.pyindex 1c1ba22302b..40270ff9145 100644--- a/zerver/webhooks/bitbucket2/tests.py+++ b/zerver/webhooks/bitbucket2/tests.py@@ -16,7 +16,6 @@ TOPIC_BRANCH_EVENTS = "Repository name / master"class Bitbucket2HookTests(WebhookTestCase):CHANNEL_NAME = "bitbucket2"URL_TEMPLATE = "/api/v1/external/bitbucket2?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "bitbucket2"def test_bitbucket2_on_push_event(self) -> None:commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"diff --git a/zerver/webhooks/bitbucket3/tests.py b/zerver/webhooks/bitbucket3/tests.pyindex d4f8c3b22ef..e72481f3046 100644--- a/zerver/webhooks/bitbucket3/tests.py+++ b/zerver/webhooks/bitbucket3/tests.py@@ -7,7 +7,6 @@ TOPIC_BRANCH_EVENTS = "sandbox / {branch}"class Bitbucket3HookTests(WebhookTestCase):CHANNEL_NAME = "bitbucket3"URL_TEMPLATE = "/api/v1/external/bitbucket3?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "bitbucket3"# Diagnostics events:def test_ping(self) -> None:diff --git a/zerver/webhooks/buildbot/tests.py b/zerver/webhooks/buildbot/tests.pyindex 0628c12c80c..da776d05063 100644--- a/zerver/webhooks/buildbot/tests.py+++ b/zerver/webhooks/buildbot/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass BuildbotHookTests(WebhookTestCase):CHANNEL_NAME = "buildbot"URL_TEMPLATE = "/api/v1/external/buildbot?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "buildbot"def test_build_started(self) -> None:expected_topic_name = "buildbot-hello"diff --git a/zerver/webhooks/canarytoken/tests.py b/zerver/webhooks/canarytoken/tests.pyindex 6c7bae6f8e8..06d7a772c0f 100644--- a/zerver/webhooks/canarytoken/tests.py+++ b/zerver/webhooks/canarytoken/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass CanarytokensHookTests(WebhookTestCase):CHANNEL_NAME = "canarytoken"URL_TEMPLATE = "/api/v1/external/canarytoken?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "canarytoken"def test_canarytoken_new(self) -> None:expected_message = (diff --git a/zerver/webhooks/circleci/tests.py b/zerver/webhooks/circleci/tests.pyindex 611f6be5202..3a69231eae4 100644--- a/zerver/webhooks/circleci/tests.py+++ b/zerver/webhooks/circleci/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass CircleCiHookTests(WebhookTestCase):CHANNEL_NAME = "circleci"URL_TEMPLATE = "/api/v1/external/circleci?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "circleci"def test_ping(self) -> None:expected_topic_name = "Test event"diff --git a/zerver/webhooks/clubhouse/tests.py b/zerver/webhooks/clubhouse/tests.pyindex a4fcae2563f..c9c9c6d80e7 100644--- a/zerver/webhooks/clubhouse/tests.py+++ b/zerver/webhooks/clubhouse/tests.py@@ -7,7 +7,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass ClubhouseWebhookTest(WebhookTestCase):CHANNEL_NAME = "clubhouse"URL_TEMPLATE = "/api/v1/external/clubhouse?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "clubhouse"def test_story_create(self) -> None:expected_message = "New story [Add cool feature!](https://app.clubhouse.io/zulip/story/11) of type **feature** was created."diff --git a/zerver/webhooks/codeship/tests.py b/zerver/webhooks/codeship/tests.pyindex c3c22061175..c8e408015c1 100644--- a/zerver/webhooks/codeship/tests.py+++ b/zerver/webhooks/codeship/tests.py@@ -5,7 +5,6 @@ class CodeshipHookTests(WebhookTestCase):CHANNEL_NAME = "codeship"URL_TEMPLATE = "/api/v1/external/codeship?stream={stream}&api_key={api_key}"TOPIC_NAME = "codeship/docs"- WEBHOOK_DIR_NAME = "codeship"def test_codeship_build_in_testing_status_message(self) -> None:"""diff --git a/zerver/webhooks/crashlytics/tests.py b/zerver/webhooks/crashlytics/tests.pyindex 44f532e32b9..4100741fd8f 100644--- a/zerver/webhooks/crashlytics/tests.py+++ b/zerver/webhooks/crashlytics/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass CrashlyticsHookTests(WebhookTestCase):CHANNEL_NAME = "crashlytics"URL_TEMPLATE = "/api/v1/external/crashlytics?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "crashlytics"def test_crashlytics_verification_message(self) -> None:expected_topic_name = "Setup"diff --git a/zerver/webhooks/dbt/tests.py b/zerver/webhooks/dbt/tests.pyindex 86704a871da..605073696db 100644--- a/zerver/webhooks/dbt/tests.py+++ b/zerver/webhooks/dbt/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass DBTHookTests(WebhookTestCase):CHANNEL_NAME = "DBT"URL_TEMPLATE = "/api/v1/external/dbt?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "dbt"def test_dbt_webhook_when_job_started(self) -> None:expected_message = """:yellow_circle: Daily Job (dbt build) deployment started in **Production**.\n@@ -30,7 +29,6 @@ Job #123 was kicked off from the UI by [email protected] at <time:2023-01-31class DBTHookWithAccessUrlTests(WebhookTestCase):CHANNEL_NAME = "DBT"URL_TEMPLATE = "/api/v1/external/dbt?&api_key={api_key}&stream={stream}&access_url=https%3A%2F%2Fexample.us1.dbt.com"- WEBHOOK_DIR_NAME = "dbt"def test_dbt_webhook_with_valid_access_url(self) -> None:expected_message = """:yellow_circle: Daily Job (dbt build) [deployment](https://example.us1.dbt.com/deploy/1/projects/167194/runs/12345) started in **Production**.\ndiff --git a/zerver/webhooks/delighted/tests.py b/zerver/webhooks/delighted/tests.pyindex 69bc770c64b..10648f8f342 100644--- a/zerver/webhooks/delighted/tests.py+++ b/zerver/webhooks/delighted/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass DelightedHookTests(WebhookTestCase):CHANNEL_NAME = "delighted"URL_TEMPLATE = "/api/v1/external/delighted?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "delighted"def test_feedback_message_promoter(self) -> None:expected_topic_name = "Survey response"diff --git a/zerver/webhooks/dialogflow/tests.py b/zerver/webhooks/dialogflow/tests.pyindex 45b33dbc885..1ab3dca1227 100644--- a/zerver/webhooks/dialogflow/tests.py+++ b/zerver/webhooks/dialogflow/tests.py@@ -3,7 +3,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass DialogflowHookTests(WebhookTestCase):URL_TEMPLATE = "/api/v1/external/dialogflow?api_key={api_key}&[email protected]"- WEBHOOK_DIR_NAME = "dialogflow"def test_dialogflow_default(self) -> None:email = self.example_user("aaron").emaildiff --git a/zerver/webhooks/dropbox/tests.py b/zerver/webhooks/dropbox/tests.pyindex b2c9f0845c7..6e77d6996a2 100644--- a/zerver/webhooks/dropbox/tests.py+++ b/zerver/webhooks/dropbox/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass DropboxHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/dropbox?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "dropbox"def test_file_updated(self) -> None:expected_topic_name = "Dropbox"diff --git a/zerver/webhooks/errbit/tests.py b/zerver/webhooks/errbit/tests.pyindex b9ed308861b..08fe281b6ce 100644--- a/zerver/webhooks/errbit/tests.py+++ b/zerver/webhooks/errbit/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass ErrBitHookTests(WebhookTestCase):CHANNEL_NAME = "errbit"URL_TEMPLATE = "/api/v1/external/errbit?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "errbit"def test_errbit_error_message(self) -> None:expected_topic_name = "ZulipIntegrationTest / ErrbitEnvName"diff --git a/zerver/webhooks/flock/tests.py b/zerver/webhooks/flock/tests.pyindex 973d098a8a4..380e160c326 100644--- a/zerver/webhooks/flock/tests.py+++ b/zerver/webhooks/flock/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass FlockHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/flock?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "flock"def test_flock_message(self) -> None:expected_topic_name = "Flock notifications"diff --git a/zerver/webhooks/freshdesk/tests.py b/zerver/webhooks/freshdesk/tests.pyindex 67d3ed36610..a827c6d1b9e 100644--- a/zerver/webhooks/freshdesk/tests.py+++ b/zerver/webhooks/freshdesk/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass FreshdeskHookTests(WebhookTestCase):CHANNEL_NAME = "freshdesk"URL_TEMPLATE = "/api/v1/external/freshdesk?stream={stream}"- WEBHOOK_DIR_NAME = "freshdesk"def test_ticket_creation(self) -> None:"""diff --git a/zerver/webhooks/freshping/tests.py b/zerver/webhooks/freshping/tests.pyindex be22b84848a..4fc32ae7ca8 100644--- a/zerver/webhooks/freshping/tests.py+++ b/zerver/webhooks/freshping/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass FreshpingHookTests(WebhookTestCase):CHANNEL_NAME = "freshping"URL_TEMPLATE = "/api/v1/external/freshping?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "freshping"def test_freshping_check_test(self) -> None:"""diff --git a/zerver/webhooks/freshstatus/tests.py b/zerver/webhooks/freshstatus/tests.pyindex a117931cd63..f015a2fab1f 100644--- a/zerver/webhooks/freshstatus/tests.py+++ b/zerver/webhooks/freshstatus/tests.py@@ -7,7 +7,6 @@ from zerver.webhooks.freshstatus.view import MISCONFIGURED_PAYLOAD_ERROR_MESSAGEclass FreshstatusHookTests(WebhookTestCase):CHANNEL_NAME = "freshstatus"URL_TEMPLATE = "/api/v1/external/freshstatus?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "freshstatus"def test_freshstatus_incident_open_multiple_services(self) -> None:"""diff --git a/zerver/webhooks/front/tests.py b/zerver/webhooks/front/tests.pyindex 30da481b44a..c98b92d6c2f 100644--- a/zerver/webhooks/front/tests.py+++ b/zerver/webhooks/front/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass FrontHookTests(WebhookTestCase):CHANNEL_NAME = "front"URL_TEMPLATE = "/api/v1/external/front?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "front"# Scenario 1: Conversation starts from an outbound message.diff --git a/zerver/webhooks/gitea/tests.py b/zerver/webhooks/gitea/tests.pyindex c7852bef868..5ecca957628 100644--- a/zerver/webhooks/gitea/tests.py+++ b/zerver/webhooks/gitea/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass GiteaHookTests(WebhookTestCase):CHANNEL_NAME = "commits"URL_TEMPLATE = "/api/v1/external/gitea?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "gitea"def test_multiple_commits(self) -> None:expected_topic_name = "test / d"diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.pyindex 697d0af7380..f65b4d60778 100644--- a/zerver/webhooks/github/tests.py+++ b/zerver/webhooks/github/tests.py@@ -21,7 +21,6 @@ TOPIC_SPONSORS = "sponsors"class GitHubWebhookTest(WebhookTestCase):CHANNEL_NAME = "github"URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "github"def test_ping_event(self) -> None:expected_message = "GitHub webhook has been successfully configured by TomaszKolek."@@ -778,7 +777,6 @@ A temporary team so that I can get some webhook fixtures!class GitHubSponsorsHookTests(WebhookTestCase):CHANNEL_NAME = "github"URL_TEMPLATE = "/api/v1/external/githubsponsors?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "github"def test_cancelled_message(self) -> None:expected_message = "monalisa cancelled their $5 a month subscription."diff --git a/zerver/webhooks/gitlab/tests.py b/zerver/webhooks/gitlab/tests.pyindex 94bd9a63128..a6303bb9aa9 100644--- a/zerver/webhooks/gitlab/tests.py+++ b/zerver/webhooks/gitlab/tests.py@@ -7,7 +7,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMITclass GitlabHookTests(WebhookTestCase):CHANNEL_NAME = "gitlab"URL_TEMPLATE = "/api/v1/external/gitlab?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "gitlab"def test_push_event_specified_topic(self) -> None:self.url = self.build_webhook_url("topic=Specific%20topic")diff --git a/zerver/webhooks/gocd/tests.py b/zerver/webhooks/gocd/tests.pyindex 8accd3913c8..eac342392b5 100644--- a/zerver/webhooks/gocd/tests.py+++ b/zerver/webhooks/gocd/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass GocdHookTests(WebhookTestCase):CHANNEL_NAME = "gocd"URL_TEMPLATE = "/api/v1/external/gocd?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "gocd"def test_building_pipeline(self) -> None:expected_topic = "Pipeline / Stage"diff --git a/zerver/webhooks/gogs/tests.py b/zerver/webhooks/gogs/tests.pyindex 21c80059bf6..801c647b244 100644--- a/zerver/webhooks/gogs/tests.py+++ b/zerver/webhooks/gogs/tests.py@@ -7,7 +7,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMITclass GogsHookTests(WebhookTestCase):CHANNEL_NAME = "commits"URL_TEMPLATE = "/api/v1/external/gogs?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "gogs"def test_push(self) -> None:expected_topic_name = "try-git / master"diff --git a/zerver/webhooks/gosquared/tests.py b/zerver/webhooks/gosquared/tests.pyindex 0e822768a98..1f46c614f2e 100644--- a/zerver/webhooks/gosquared/tests.py+++ b/zerver/webhooks/gosquared/tests.py@@ -5,7 +5,6 @@ from zerver.webhooks.gosquared.view import CHAT_MESSAGE_TEMPLATEclass GoSquaredHookTests(WebhookTestCase):CHANNEL_NAME = "gosquared"URL_TEMPLATE = "/api/v1/external/gosquared?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "gosquared"# Note: Include a test function per each distinct message condition your integration supportsdef test_traffic_message(self) -> None:diff --git a/zerver/webhooks/grafana/tests.py b/zerver/webhooks/grafana/tests.pyindex a39032d1106..823caa4dc10 100644--- a/zerver/webhooks/grafana/tests.py+++ b/zerver/webhooks/grafana/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass GrafanaHookTests(WebhookTestCase):CHANNEL_NAME = "grafana"URL_TEMPLATE = "/api/v1/external/grafana?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "grafana"def test_alert_v7(self) -> None:expected_topic_name = "[Alerting] Test notification"diff --git a/zerver/webhooks/greenhouse/tests.py b/zerver/webhooks/greenhouse/tests.pyindex 73fd9904776..44425a13644 100644--- a/zerver/webhooks/greenhouse/tests.py+++ b/zerver/webhooks/greenhouse/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass GreenhouseHookTests(WebhookTestCase):CHANNEL_NAME = "greenhouse"URL_TEMPLATE = "/api/v1/external/greenhouse?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "greenhouse"CONTENT_TYPE = "application/x-www-form-urlencoded"def test_message_candidate_hired(self) -> None:diff --git a/zerver/webhooks/groove/tests.py b/zerver/webhooks/groove/tests.pyindex 3c7ef99fc26..e663f9e43ed 100644--- a/zerver/webhooks/groove/tests.py+++ b/zerver/webhooks/groove/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass GrooveHookTests(WebhookTestCase):CHANNEL_NAME = "groove"URL_TEMPLATE = "/api/v1/external/groove?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "groove"# This test simulates the condition when a new ticket comes.def test_groove_ticket_started(self) -> None:diff --git a/zerver/webhooks/harbor/tests.py b/zerver/webhooks/harbor/tests.pyindex 83c0466d306..865753db47a 100644--- a/zerver/webhooks/harbor/tests.py+++ b/zerver/webhooks/harbor/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass HarborHookTests(WebhookTestCase):CHANNEL_NAME = "harbor"URL_TEMPLATE = "/api/v1/external/harbor?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "harbor"def test_push_image(self) -> None:expected_topic_name = "example/test"diff --git a/zerver/webhooks/hellosign/tests.py b/zerver/webhooks/hellosign/tests.pyindex e35efb811ac..bd3b4daac2f 100644--- a/zerver/webhooks/hellosign/tests.py+++ b/zerver/webhooks/hellosign/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass HelloSignHookTests(WebhookTestCase):CHANNEL_NAME = "hellosign"URL_TEMPLATE = "/api/v1/external/hellosign?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "hellosign"def test_signatures_message(self) -> None:expected_topic_name = "NDA with Acme Co."diff --git a/zerver/webhooks/helloworld/tests.py b/zerver/webhooks/helloworld/tests.pyindex a3c7d0f09ca..53e55bc6b2f 100644--- a/zerver/webhooks/helloworld/tests.py+++ b/zerver/webhooks/helloworld/tests.py@@ -9,7 +9,6 @@ class HelloWorldHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}"DIRECT_MESSAGE_URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}"- WEBHOOK_DIR_NAME = "helloworld"# Note: Include a test function per each distinct message condition your integration supportsdef test_hello_message(self) -> None:diff --git a/zerver/webhooks/homeassistant/tests.py b/zerver/webhooks/homeassistant/tests.pyindex 0445eee81de..29f4fbd0a15 100644--- a/zerver/webhooks/homeassistant/tests.py+++ b/zerver/webhooks/homeassistant/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass HomeAssistantHookTests(WebhookTestCase):CHANNEL_NAME = "homeassistant"URL_TEMPLATE = "/api/v1/external/homeassistant?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "homeassistant"def test_simplereq(self) -> None:expected_topic_name = "homeassistant"diff --git a/zerver/webhooks/ifttt/tests.py b/zerver/webhooks/ifttt/tests.pyindex 7359bfc198e..f04548bc006 100644--- a/zerver/webhooks/ifttt/tests.py+++ b/zerver/webhooks/ifttt/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass IFTTTHookTests(WebhookTestCase):CHANNEL_NAME = "ifttt"URL_TEMPLATE = "/api/v1/external/ifttt?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "ifttt"def test_ifttt_when_subject_and_body_are_correct(self) -> None:expected_topic_name = "Email sent from [email protected]"diff --git a/zerver/webhooks/insping/tests.py b/zerver/webhooks/insping/tests.pyindex 1d36cf789b0..70ad1c0cf49 100644--- a/zerver/webhooks/insping/tests.py+++ b/zerver/webhooks/insping/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass InspingHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/insping?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "insping"def test_website_state_available_message(self) -> None:expected_topic_name = "insping"diff --git a/zerver/webhooks/intercom/tests.py b/zerver/webhooks/intercom/tests.pyindex d68306b070e..7599a9c1d44 100644--- a/zerver/webhooks/intercom/tests.py+++ b/zerver/webhooks/intercom/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass IntercomWebHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/intercom?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "intercom"def test_ping(self) -> None:expected_topic_name = "Intercom"diff --git a/zerver/webhooks/jira/tests.py b/zerver/webhooks/jira/tests.pyindex 8938a5ea142..7e373458c19 100644--- a/zerver/webhooks/jira/tests.py+++ b/zerver/webhooks/jira/tests.py@@ -7,7 +7,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass JiraHookTests(WebhookTestCase):CHANNEL_NAME = "jira"URL_TEMPLATE = "/api/v1/external/jira?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "jira"def test_custom_channel(self) -> None:api_key = self.test_user.api_keydiff --git a/zerver/webhooks/jotform/tests.py b/zerver/webhooks/jotform/tests.pyindex 3a59ddf0df2..a5917c09768 100644--- a/zerver/webhooks/jotform/tests.py+++ b/zerver/webhooks/jotform/tests.py@@ -7,7 +7,6 @@ from zerver.lib.webhooks.common import parse_multipart_stringclass JotformHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/jotform?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "jotform"def test_response(self) -> None:expected_title = "Tutor Appointment Form"diff --git a/zerver/webhooks/json/tests.py b/zerver/webhooks/json/tests.pyindex 2851f8d45b3..04065fb8c34 100644--- a/zerver/webhooks/json/tests.py+++ b/zerver/webhooks/json/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass JsonHookTests(WebhookTestCase):CHANNEL_NAME = "json"URL_TEMPLATE = "/api/v1/external/json?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "json"def test_json_github_push__1_commit_message(self) -> None:"""diff --git a/zerver/webhooks/librato/tests.py b/zerver/webhooks/librato/tests.pyindex 3038194aa76..3b0ad794fa0 100644--- a/zerver/webhooks/librato/tests.py+++ b/zerver/webhooks/librato/tests.py@@ -8,7 +8,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass LibratoHookTests(WebhookTestCase):CHANNEL_NAME = "librato"URL_TEMPLATE = "/api/v1/external/librato?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "librato"IS_ATTACHMENT = False@overridediff --git a/zerver/webhooks/lidarr/tests.py b/zerver/webhooks/lidarr/tests.pyindex cf74db97215..c73c100f9ba 100644--- a/zerver/webhooks/lidarr/tests.py+++ b/zerver/webhooks/lidarr/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass LidarrHookTests(WebhookTestCase):CHANNEL_NAME = "lidarr"URL_TEMPLATE = "/api/v1/external/lidarr?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "lidarr"def test_lidarr_test(self) -> None:"""diff --git a/zerver/webhooks/linear/tests.py b/zerver/webhooks/linear/tests.pyindex 088909bfb59..0fceee01b78 100644--- a/zerver/webhooks/linear/tests.py+++ b/zerver/webhooks/linear/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass LinearHookTests(WebhookTestCase):CHANNEL_NAME = "Linear"URL_TEMPLATE = "/api/v1/external/linear?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "linear"def test_issue_create_simple_without_description(self) -> None:expected_topic_name = "Issue: Drop-down overflow in the select menu."diff --git a/zerver/webhooks/mention/tests.py b/zerver/webhooks/mention/tests.pyindex 4153e70def6..a69a84a6fab 100644--- a/zerver/webhooks/mention/tests.py+++ b/zerver/webhooks/mention/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass MentionHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/mention?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "mention"def test_mention_webfeed(self) -> None:expected_topic_name = "news"diff --git a/zerver/webhooks/netlify/tests.py b/zerver/webhooks/netlify/tests.pyindex 35a54598061..22274137ff5 100644--- a/zerver/webhooks/netlify/tests.py+++ b/zerver/webhooks/netlify/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass NetlifyHookTests(WebhookTestCase):CHANNEL_NAME = "netlify"URL_TEMPLATE = "/api/v1/external/netlify?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "netlify"def test_building_message(self) -> None:expected_topic_name = "master"diff --git a/zerver/webhooks/newrelic/tests.py b/zerver/webhooks/newrelic/tests.pyindex 174e7e8818e..8ee603793c9 100644--- a/zerver/webhooks/newrelic/tests.py+++ b/zerver/webhooks/newrelic/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass NewRelicHookTests(WebhookTestCase):CHANNEL_NAME = "newrelic"URL_TEMPLATE = "/api/v1/external/newrelic?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "newrelic"def test_incident_activated_new_default_payload(self) -> None:expected_topic_name = "zulip_app query result is > 1.0 for 1 minutes on 'Zulip S..."diff --git a/zerver/webhooks/opencollective/tests.py b/zerver/webhooks/opencollective/tests.pyindex b7de100466d..2e24bc0e65d 100644--- a/zerver/webhooks/opencollective/tests.py+++ b/zerver/webhooks/opencollective/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass OpenCollectiveHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/opencollective?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "opencollective"# Note: Include a test function per each distinct message condition your integration supportsdef test_one_time_donation(self) -> None: # test one time donationdiff --git a/zerver/webhooks/openproject/tests.py b/zerver/webhooks/openproject/tests.pyindex c06f13e2635..f8465bbd6a2 100644--- a/zerver/webhooks/openproject/tests.py+++ b/zerver/webhooks/openproject/tests.py@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass OpenProjectHookTests(WebhookTestCase):CHANNEL_NAME = "OpenProjectUpdates"URL_TEMPLATE = "/api/v1/external/openproject?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "openproject"- STREAM_NAME = "OpenProjectUpdates"def test_project_with_parent_created(self) -> None:expected_topic = "AI Backend"diff --git a/zerver/webhooks/opensearch/tests.py b/zerver/webhooks/opensearch/tests.pyindex d17a8f06761..2f524482b9b 100644--- a/zerver/webhooks/opensearch/tests.py+++ b/zerver/webhooks/opensearch/tests.py@@ -7,7 +7,6 @@ class OpensearchHookTests(WebhookTestCase):CHANNEL_NAME = "Opensearch Alerts"TOPIC_NAME = "OpenSearch alerts"URL_TEMPLATE = "/api/v1/external/opensearch?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "opensearch"@overridedef setUp(self) -> None:@@ -16,7 +15,7 @@ class OpensearchHookTests(WebhookTestCase):@overridedef get_body(self, fixture_name: str) -> str:- body = self.webhook_fixture_data(self.WEBHOOK_DIR_NAME, fixture_name, file_type="txt")+ body = self.webhook_fixture_data(self.webhook_dir_name, fixture_name, file_type="txt")return bodydef test_test_notification_from_channel(self) -> None:diff --git a/zerver/webhooks/opsgenie/tests.py b/zerver/webhooks/opsgenie/tests.pyindex 8dbc408918d..287f968e929 100644--- a/zerver/webhooks/opsgenie/tests.py+++ b/zerver/webhooks/opsgenie/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass OpsgenieHookTests(WebhookTestCase):CHANNEL_NAME = "opsgenie"URL_TEMPLATE = "/api/v1/external/opsgenie?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "opsgenie"def test_acknowledge_alert(self) -> None:expected_topic_name = "Integration1"diff --git a/zerver/webhooks/pagerduty/tests.py b/zerver/webhooks/pagerduty/tests.pyindex 6d3d4517a5e..6fb85c7d11b 100644--- a/zerver/webhooks/pagerduty/tests.py+++ b/zerver/webhooks/pagerduty/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass PagerDutyHookTests(WebhookTestCase):CHANNEL_NAME = "pagerduty"URL_TEMPLATE = "/api/v1/external/pagerduty?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "pagerduty"def test_trigger(self) -> None:expected_message = "Incident [3](https://zulip-test.pagerduty.com/incidents/P140S4Y) triggered by [Test service](https://zulip-test.pagerduty.com/services/PIL5CUQ) (assigned to [armooo](https://zulip-test.pagerduty.com/users/POBCFRJ)).\n\n``` quote\nfoo\n```"diff --git a/zerver/webhooks/papertrail/tests.py b/zerver/webhooks/papertrail/tests.pyindex c5933f186b3..f4b633099dc 100644--- a/zerver/webhooks/papertrail/tests.py+++ b/zerver/webhooks/papertrail/tests.py@@ -8,7 +8,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass PapertrailHookTests(WebhookTestCase):CHANNEL_NAME = "papertrail"URL_TEMPLATE = "/api/v1/external/papertrail?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "papertrail"def test_short_message(self) -> None:expected_topic_name = "logs"diff --git a/zerver/webhooks/patreon/tests.py b/zerver/webhooks/patreon/tests.pyindex 65a224831c1..55c21576936 100644--- a/zerver/webhooks/patreon/tests.py+++ b/zerver/webhooks/patreon/tests.py@@ -15,7 +15,6 @@ IGNORED_EVENTS = [class PatreonHookTests(WebhookTestCase):CHANNEL_NAME = "Patreon"URL_TEMPLATE = "/api/v1/external/patreon?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "patreon"def test_patreon_members_create(self) -> None:expected_message = "Kopi has joined as a member!"diff --git a/zerver/webhooks/pingdom/tests.py b/zerver/webhooks/pingdom/tests.pyindex 70dd092fcf0..e3058e1f476 100644--- a/zerver/webhooks/pingdom/tests.py+++ b/zerver/webhooks/pingdom/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass PingdomHookTests(WebhookTestCase):CHANNEL_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:"""diff --git a/zerver/webhooks/pivotal/tests.py b/zerver/webhooks/pivotal/tests.pyindex b78d218ffd3..f3de6149ca9 100644--- a/zerver/webhooks/pivotal/tests.py+++ b/zerver/webhooks/pivotal/tests.py@@ -11,7 +11,6 @@ from zerver.webhooks.pivotal.view import api_pivotal_webhook_v5class PivotalV3HookTests(WebhookTestCase):CHANNEL_NAME = "pivotal"URL_TEMPLATE = "/api/v1/external/pivotal?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "pivotal"def test_accepted(self) -> None:expected_topic_name = "My new Feature story"@@ -114,7 +113,6 @@ class PivotalV3HookTests(WebhookTestCase):class PivotalV5HookTests(WebhookTestCase):CHANNEL_NAME = "pivotal"URL_TEMPLATE = "/api/v1/external/pivotal?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "pivotal"def test_accepted(self) -> None:expected_topic_name = "#63486316: Story of the Year"diff --git a/zerver/webhooks/radarr/tests.py b/zerver/webhooks/radarr/tests.pyindex 3990b98b663..ff480fb0d96 100644--- a/zerver/webhooks/radarr/tests.py+++ b/zerver/webhooks/radarr/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass RadarrHookTests(WebhookTestCase):CHANNEL_NAME = "radarr"URL_TEMPLATE = "/api/v1/external/radarr?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "radarr"def test_radarr_test(self) -> None:"""diff --git a/zerver/webhooks/raygun/tests.py b/zerver/webhooks/raygun/tests.pyindex ee9e752f0a0..ff006b9f255 100644--- a/zerver/webhooks/raygun/tests.py+++ b/zerver/webhooks/raygun/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass RaygunHookTests(WebhookTestCase):CHANNEL_NAME = "raygun"URL_TEMPLATE = "/api/v1/external/raygun?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "raygun"def test_status_changed_message(self) -> None:expected_topic_name = "test"diff --git a/zerver/webhooks/reviewboard/tests.py b/zerver/webhooks/reviewboard/tests.pyindex e2feb84f5ca..d8e589dc532 100644--- a/zerver/webhooks/reviewboard/tests.py+++ b/zerver/webhooks/reviewboard/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass ReviewBoardHookTests(WebhookTestCase):CHANNEL_NAME = "reviewboard"URL_TEMPLATE = "/api/v1/external/reviewboard?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "reviewboard"def test_review_request_published(self) -> None:expected_topic_name = "Scheduler"diff --git a/zerver/webhooks/rhodecode/tests.py b/zerver/webhooks/rhodecode/tests.pyindex adb8a2e9e70..7288f0d977d 100644--- a/zerver/webhooks/rhodecode/tests.py+++ b/zerver/webhooks/rhodecode/tests.py@@ -7,7 +7,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMITclass RhodecodeHookTests(WebhookTestCase):CHANNEL_NAME = "rhodecode"URL_TEMPLATE = "/api/v1/external/rhodecode?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "rhodecode"def test_push_event_message(self) -> None:expected_topic_name = "u/yuroitaki/zulip-testing / master"diff --git a/zerver/webhooks/rundeck/tests.py b/zerver/webhooks/rundeck/tests.pyindex afc38589190..e90f56faf44 100644--- a/zerver/webhooks/rundeck/tests.py+++ b/zerver/webhooks/rundeck/tests.py@@ -5,7 +5,6 @@ class RundeckHookTests(WebhookTestCase):CHANNEL_NAME = "Rundeck"TOPIC_NAME = "Global Log Filter Usage"URL_TEMPLATE = "/api/v1/external/rundeck?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "rundeck"def test_start_message(self) -> None:expected_message = "[Global Log Filter Usage](http://localhost:4440/project/welcome-project-community/job/show/a0296d93-4b10-48d7-8b7d-86ad3f603b85) execution [#3](http://localhost:4440/project/welcome-project-community/execution/show/3) for welcome-project-community has started. :running:"diff --git a/zerver/webhooks/semaphore/tests.py b/zerver/webhooks/semaphore/tests.pyindex 85af21edd78..a657373ee7c 100644--- a/zerver/webhooks/semaphore/tests.py+++ b/zerver/webhooks/semaphore/tests.py@@ -8,7 +8,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass SemaphoreHookTests(WebhookTestCase):CHANNEL_NAME = "semaphore"URL_TEMPLATE = "/api/v1/external/semaphore?stream={stream}&api_key={api_key}"- WEBHOOK_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 anddiff --git a/zerver/webhooks/sentry/tests.py b/zerver/webhooks/sentry/tests.pyindex 8e156bbf8a4..387f9bfbdcf 100644--- a/zerver/webhooks/sentry/tests.py+++ b/zerver/webhooks/sentry/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass SentryHookTests(WebhookTestCase):CHANNEL_NAME = "sentry"URL_TEMPLATE = "/api/v1/external/sentry?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "sentry"def test_event_for_exception_golang(self) -> None:expected_topic_name = '*url.Error: Get "bad_url": unsupported protocol scheme ""'diff --git a/zerver/webhooks/slack/tests.py b/zerver/webhooks/slack/tests.pyindex 240768860ab..cd440fb7282 100644--- a/zerver/webhooks/slack/tests.py+++ b/zerver/webhooks/slack/tests.py@@ -48,7 +48,6 @@ def mock_slack_api_calls(class SlackWebhookTests(WebhookTestCase):CHANNEL_NAME = "slack"URL_TEMPLATE = "/api/v1/external/slack?stream={stream}&api_key={api_key}&slack_app_token=xoxp-XXXXXXXXXXXXXXXXXXXXX"- WEBHOOK_DIR_NAME = "slack"@mock_slack_api_callsdef test_slack_only_stream_parameter(self) -> None:@@ -415,7 +414,6 @@ class SlackWebhookTests(WebhookTestCase):class SlackLegacyWebhookTests(WebhookTestCase):CHANNEL_NAME = "slack"URL_TEMPLATE = "/api/v1/external/slack?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "slack"def test_slack_only_stream_parameter(self) -> None:expected_topic_name = "Message from Slack"diff --git a/zerver/webhooks/slack_incoming/tests.py b/zerver/webhooks/slack_incoming/tests.pyindex 8dc571c2fdf..872e78008ca 100644--- a/zerver/webhooks/slack_incoming/tests.py+++ b/zerver/webhooks/slack_incoming/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass SlackIncomingHookTests(WebhookTestCase):CHANNEL_NAME = "slack_incoming"URL_TEMPLATE = "/api/v1/external/slack_incoming?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "slack_incoming"def test_message(self) -> None:expected_topic_name = ""diff --git a/zerver/webhooks/sonarqube/tests.py b/zerver/webhooks/sonarqube/tests.pyindex c2b11aa1fee..5bdbe6a8c2a 100644--- a/zerver/webhooks/sonarqube/tests.py+++ b/zerver/webhooks/sonarqube/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass SonarqubeHookTests(WebhookTestCase):CHANNEL_NAME = "SonarQube"URL_TEMPLATE = "/api/v1/external/sonarqube?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "sonarqube"def test_analysis_success(self) -> None:expected_topic_name = "test-sonar / master"diff --git a/zerver/webhooks/sonarr/tests.py b/zerver/webhooks/sonarr/tests.pyindex 4512532a529..f34b0ef62e6 100644--- a/zerver/webhooks/sonarr/tests.py+++ b/zerver/webhooks/sonarr/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass SonarrHookTests(WebhookTestCase):CHANNEL_NAME = "sonarr"URL_TEMPLATE = "/api/v1/external/sonarr?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "sonarr"def test_sonarr_test(self) -> None:"""diff --git a/zerver/webhooks/splunk/tests.py b/zerver/webhooks/splunk/tests.pyindex 7683b422c3d..de9e65ecde7 100644--- a/zerver/webhooks/splunk/tests.py+++ b/zerver/webhooks/splunk/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass SplunkHookTests(WebhookTestCase):CHANNEL_NAME = "splunk"URL_TEMPLATE = "/api/v1/external/splunk?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "splunk"def test_splunk_search_one_result(self) -> None:self.url = self.build_webhook_url(topic="New Search Alert")diff --git a/zerver/webhooks/statuspage/tests.py b/zerver/webhooks/statuspage/tests.pyindex 16eec07e646..07dc28c8253 100644--- a/zerver/webhooks/statuspage/tests.py+++ b/zerver/webhooks/statuspage/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass StatuspageHookTests(WebhookTestCase):CHANNEL_NAME = "statuspage-test"URL_TEMPLATE = "/api/v1/external/statuspage?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "statuspage"def test_statuspage_incident(self) -> None:expected_topic_name = "Database query delays: All Systems Operational"diff --git a/zerver/webhooks/stripe/tests.py b/zerver/webhooks/stripe/tests.pyindex c622e8f1354..66c49c59a6a 100644--- a/zerver/webhooks/stripe/tests.py+++ b/zerver/webhooks/stripe/tests.py@@ -7,7 +7,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass StripeHookTests(WebhookTestCase):CHANNEL_NAME = "test"URL_TEMPLATE = "/api/v1/external/stripe?&api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "stripe"def test_charge_dispute_closed(self) -> None:expected_topic_name = "disputes"diff --git a/zerver/webhooks/taiga/tests.py b/zerver/webhooks/taiga/tests.pyindex c72832f498f..a3ee5570f51 100644--- a/zerver/webhooks/taiga/tests.py+++ b/zerver/webhooks/taiga/tests.py@@ -7,7 +7,6 @@ class TaigaHookTests(WebhookTestCase):CHANNEL_NAME = "taiga"TOPIC_NAME = "subject"URL_TEMPLATE = "/api/v1/external/taiga?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "taiga"@overridedef setUp(self) -> None:diff --git a/zerver/webhooks/teamcity/tests.py b/zerver/webhooks/teamcity/tests.pyindex 7910cf1dace..f525a163394 100644--- a/zerver/webhooks/teamcity/tests.py+++ b/zerver/webhooks/teamcity/tests.py@@ -12,7 +12,6 @@ class TeamCityHookTests(WebhookTestCase):CHANNEL_NAME = "teamcity"URL_TEMPLATE = "/api/v1/external/teamcity?stream={stream}&api_key={api_key}"TOPIC_NAME = "Project :: Compile"- WEBHOOK_DIR_NAME = "teamcity"def test_teamcity_success(self) -> None:expected_message = "Project :: Compile build 5535 - CL 123456 was successful! :thumbs_up: See [changes](http://teamcity/viewLog.html?buildTypeId=Project_Compile&buildId=19952&tab=buildChangesDiv) and [build log](http://teamcity/viewLog.html?buildTypeId=Project_Compile&buildId=19952)."@@ -38,7 +37,7 @@ class TeamCityHookTests(WebhookTestCase):def test_teamcity_personal(self) -> None:expected_message = "Your personal build for Project :: Compile build 5535 - CL 123456 is broken with status Exit code 1 (new)! :thumbs_down: See [changes](http://teamcity/viewLog.html?buildTypeId=Project_Compile&buildId=19952&tab=buildChangesDiv) and [build log](http://teamcity/viewLog.html?buildTypeId=Project_Compile&buildId=19952)."payload = orjson.dumps(- orjson.loads(self.webhook_fixture_data(self.WEBHOOK_DIR_NAME, "personal"))+ orjson.loads(self.webhook_fixture_data(self.webhook_dir_name, "personal")))self.client_post(self.url, payload, content_type="application/json")msg = self.get_last_message()diff --git a/zerver/webhooks/thinkst/tests.py b/zerver/webhooks/thinkst/tests.pyindex af5fff13f5b..64740ee5a69 100644--- a/zerver/webhooks/thinkst/tests.py+++ b/zerver/webhooks/thinkst/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass ThinkstHookTests(WebhookTestCase):CHANNEL_NAME = "thinkst"URL_TEMPLATE = "/api/v1/external/thinkst?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "thinkst"def test_canary_dummy(self) -> None:expected_message = (diff --git a/zerver/webhooks/transifex/tests.py b/zerver/webhooks/transifex/tests.pyindex 835796e44fe..11b8cf39d75 100644--- a/zerver/webhooks/transifex/tests.py+++ b/zerver/webhooks/transifex/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass TransifexHookTests(WebhookTestCase):CHANNEL_NAME = "transifex"URL_TEMPLATE = "/api/v1/external/transifex?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "transifex"PROJECT = "project-title"LANGUAGE = "en"diff --git a/zerver/webhooks/travis/tests.py b/zerver/webhooks/travis/tests.pyindex 107db4b076f..e66d96b0061 100644--- a/zerver/webhooks/travis/tests.py+++ b/zerver/webhooks/travis/tests.py@@ -8,7 +8,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass TravisHookTests(WebhookTestCase):CHANNEL_NAME = "travis"URL_TEMPLATE = "/api/v1/external/travis?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "travis"TOPIC_NAME = "builds"EXPECTED_MESSAGE = """Author: josh_mandeldiff --git a/zerver/webhooks/trello/tests.py b/zerver/webhooks/trello/tests.pyindex f5952655ec3..4c40bdfd939 100644--- a/zerver/webhooks/trello/tests.py+++ b/zerver/webhooks/trello/tests.py@@ -8,7 +8,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass TrelloHookTests(WebhookTestCase):CHANNEL_NAME = "trello"URL_TEMPLATE = "/api/v1/external/trello?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "trello"def test_trello_confirmation_request(self) -> None:response = self.client_head(self.build_webhook_url())diff --git a/zerver/webhooks/updown/tests.py b/zerver/webhooks/updown/tests.pyindex a816c004163..b7e4dab3b62 100644--- a/zerver/webhooks/updown/tests.py+++ b/zerver/webhooks/updown/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass UpdownHookTests(WebhookTestCase):CHANNEL_NAME = "updown"URL_TEMPLATE = "/api/v1/external/updown?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "updown"def test_updown_check_down_event(self) -> None:expected_topic_name = "https://updown.io"diff --git a/zerver/webhooks/uptimerobot/tests.py b/zerver/webhooks/uptimerobot/tests.pyindex 1abab1900ef..158da404463 100644--- a/zerver/webhooks/uptimerobot/tests.py+++ b/zerver/webhooks/uptimerobot/tests.py@@ -7,7 +7,6 @@ from zerver.webhooks.uptimerobot.view import MISCONFIGURED_PAYLOAD_ERROR_MESSAGEclass UptimeRobotHookTests(WebhookTestCase):CHANNEL_NAME = "uptimerobot"URL_TEMPLATE = "/api/v1/external/uptimerobot?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "uptimerobot"def test_uptimerobot_monitor_down(self) -> None:"""diff --git a/zerver/webhooks/wordpress/tests.py b/zerver/webhooks/wordpress/tests.pyindex ebe8ad4112b..ed2f35d9a87 100644--- a/zerver/webhooks/wordpress/tests.py+++ b/zerver/webhooks/wordpress/tests.py@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass WordPressHookTests(WebhookTestCase):CHANNEL_NAME = "wordpress"URL_TEMPLATE = "/api/v1/external/wordpress?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "wordpress"def test_publish_post(self) -> None:expected_topic_name = "WordPress Post"diff --git a/zerver/webhooks/zabbix/tests.py b/zerver/webhooks/zabbix/tests.pyindex 9b73c9ddb2f..307ef6412a0 100644--- a/zerver/webhooks/zabbix/tests.py+++ b/zerver/webhooks/zabbix/tests.py@@ -7,7 +7,6 @@ from zerver.webhooks.zabbix.view import MISCONFIGURED_PAYLOAD_ERROR_MESSAGEclass ZabbixHookTests(WebhookTestCase):CHANNEL_NAME = "zabbix"URL_TEMPLATE = "/api/v1/external/zabbix?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "zabbix"def test_zabbix_alert_message(self) -> None:"""diff --git a/zerver/webhooks/zapier/tests.py b/zerver/webhooks/zapier/tests.pyindex 7662895cbd8..f49d5a52dd6 100644--- a/zerver/webhooks/zapier/tests.py+++ b/zerver/webhooks/zapier/tests.py@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCaseclass ZapierHookTests(WebhookTestCase):CHANNEL_NAME = "zapier"URL_TEMPLATE = "/api/v1/external/zapier?stream={stream}&api_key={api_key}"- WEBHOOK_DIR_NAME = "zapier"def test_zapier_when_subject_and_body_are_correct(self) -> None:expected_topic_name = "New email from [email protected]"@@ -27,7 +26,6 @@ class ZapierHookTests(WebhookTestCase):class ZapierZulipAppTests(WebhookTestCase):CHANNEL_NAME = "zapier"URL_TEMPLATE = "/api/v1/external/zapier?api_key={api_key}&stream={stream}"- WEBHOOK_DIR_NAME = "zapier"def test_auth(self) -> None:payload = self.get_body("zapier_zulip_app_auth")