Skip to content

armgit / zulip

Public Imported from GitHub
0

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.md
index 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 supports
def 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` refer
to class attributes from the base class, `WebhookTestCase`. These are needed by
the helper function `check_webhook` to determine how to execute
your 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.py
index 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 no
available 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: str
WEBHOOK_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__}")
+
@override
def 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 properly
registered via the @webhook_view(..., event_types=[...]). These registrations are important for Zulip
self-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 w
payload = 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 json
orjson.loads(body)
return body
diff --git a/zerver/tests/test_webhooks_common.py b/zerver/tests/test_webhooks_common.py
index 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 mock
diff --git a/zerver/webhooks/airbrake/tests.py b/zerver/webhooks/airbrake/tests.py
index 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 WebhookTestCase
class 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.py
index 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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_markdown
class 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.py
index 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 WebhookTestCase
class 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.py
index 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_LIMIT
class 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.py
index 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.py
index 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 WebhookTestCase
class 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.py
index 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.py
index 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.py
index 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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-31
class 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**.\n
diff --git a/zerver/webhooks/delighted/tests.py b/zerver/webhooks/delighted/tests.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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").email
diff --git a/zerver/webhooks/dropbox/tests.py b/zerver/webhooks/dropbox/tests.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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_MESSAGE
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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.py
index 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_LIMIT
class 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.py
index 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 WebhookTestCase
class 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.py
index 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_LIMIT
class 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.py
index 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_TEMPLATE
class 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 supports
def test_traffic_message(self) -> None:
diff --git a/zerver/webhooks/grafana/tests.py b/zerver/webhooks/grafana/tests.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 supports
def test_hello_message(self) -> None:
diff --git a/zerver/webhooks/homeassistant/tests.py b/zerver/webhooks/homeassistant/tests.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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_key
diff --git a/zerver/webhooks/jotform/tests.py b/zerver/webhooks/jotform/tests.py
index 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_string
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class LibratoHookTests(WebhookTestCase):
CHANNEL_NAME = "librato"
URL_TEMPLATE = "/api/v1/external/librato?api_key={api_key}&stream={stream}"
- WEBHOOK_DIR_NAME = "librato"
IS_ATTACHMENT = False
@override
diff --git a/zerver/webhooks/lidarr/tests.py b/zerver/webhooks/lidarr/tests.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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 supports
def test_one_time_donation(self) -> None: # test one time donation
diff --git a/zerver/webhooks/openproject/tests.py b/zerver/webhooks/openproject/tests.py
index 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 WebhookTestCase
class 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.py
index 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"
@override
def setUp(self) -> None:
@@ -16,7 +15,7 @@ class OpensearchHookTests(WebhookTestCase):
@override
def 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 body
def test_test_notification_from_channel(self) -> None:
diff --git a/zerver/webhooks/opsgenie/tests.py b/zerver/webhooks/opsgenie/tests.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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.py
index 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 WebhookTestCase
class 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.py
index 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_v5
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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_LIMIT
class 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.py
index 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.py
index 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 WebhookTestCase
class 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 and
diff --git a/zerver/webhooks/sentry/tests.py b/zerver/webhooks/sentry/tests.py
index 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 WebhookTestCase
class 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.py
index 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_calls
def 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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"
@override
def setUp(self) -> None:
diff --git a/zerver/webhooks/teamcity/tests.py b/zerver/webhooks/teamcity/tests.py
index 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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_mandel
diff --git a/zerver/webhooks/trello/tests.py b/zerver/webhooks/trello/tests.py
index 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 WebhookTestCase
class 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.py
index 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 WebhookTestCase
class 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.py
index 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_MESSAGE
class 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.py
index 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 WebhookTestCase
class 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.py
index 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_MESSAGE
class 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.py
index 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 WebhookTestCase
class 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")