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 URL_TEMPLATE optional in test classes.

Niloth Pc919785a188f
diff --git a/api_docs/incoming-webhooks-walkthrough.md b/api_docs/incoming-webhooks-walkthrough.md
index e13428a7cd6..a9b6d755af5 100644
--- a/api_docs/incoming-webhooks-walkthrough.md
+++ b/api_docs/incoming-webhooks-walkthrough.md
@@ -410,7 +410,6 @@ class `HelloWorldHookTests`:
```python
class HelloWorldHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}"
DIRECT_MESSAGE_URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}"
# Note: Include a test function per each distinct message condition your integration supports
@@ -427,13 +426,6 @@ class HelloWorldHookTests(WebhookTestCase):
)
```
-In the above example, `URL_TEMPLATE` refers to class attributes from the
-base class, `WebhookTestCase`. It is needed by the helper function
-`check_webhook` to determine how to execute your test. `URL_TEMPLATE`
-defines how the test runner will call your incoming webhook, in the same way
-you would provide a webhook URL to the 3rd party service.
-`api_key={api_key}` says that an API key is expected.
-
When writing tests for your webhook, you'll want to include one test function
(and corresponding fixture) per each distinct message condition that your
integration supports.
@@ -666,7 +658,6 @@ attribute `TOPIC` as a keyword argument to `build_webhook_url`, like so:
class QuerytestHookTests(WebhookTestCase):
TOPIC = "Default topic"
- URL_TEMPLATE = "/api/v1/external/querytest?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = 'querytest'
def test_querytest_test_one(self) -> None:
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py
index 9bf95c80a1a..210172a00d6 100644
--- a/zerver/lib/test_classes.py
+++ b/zerver/lib/test_classes.py
@@ -2466,8 +2466,11 @@ class WebhookTestCase(ZulipTestCase):
"""
TEST_USER_EMAIL = "[email protected]"
- URL_TEMPLATE: str
+ URL_TEMPLATE: str = ""
WEBHOOK_DIR_NAME: str | None = None
+ DEFAULT_URL_TEMPLATE: str = (
+ "/api/v1/external/{webhook_dir_name}?stream={stream}&api_key={api_key}"
+ )
def get_webhook_dir_name(self) -> str:
module_parts = self.__module__.split(".")
@@ -2481,6 +2484,7 @@ class WebhookTestCase(ZulipTestCase):
self.test_user = self.get_user_from_email(self.TEST_USER_EMAIL, get_realm("zulip"))
self.webhook_dir_name = self.WEBHOOK_DIR_NAME or self.get_webhook_dir_name()
self.channel_name = self.webhook_dir_name
+ self.url_template = self.URL_TEMPLATE or self.DEFAULT_URL_TEMPLATE
self.url = self.build_webhook_url()
function = import_string(
@@ -2659,12 +2663,12 @@ one or more new messages.
return msg
def build_webhook_url(self, *args: str, **kwargs: str) -> str:
- url = self.URL_TEMPLATE
- if url.find("api_key") >= 0:
- api_key = self.test_user.api_key
- url = self.URL_TEMPLATE.format(api_key=api_key, stream=self.channel_name)
- else:
- url = self.URL_TEMPLATE.format(stream=self.channel_name)
+ url = self.url_template
+ assert url.find("api_key") >= 0
+ api_key = self.test_user.api_key
+ url = self.url_template.format(
+ webhook_dir_name=self.webhook_dir_name, api_key=api_key, stream=self.channel_name
+ )
has_arguments = kwargs or args
if has_arguments and url.find("?") == -1:
diff --git a/zerver/tests/test_webhooks_common.py b/zerver/tests/test_webhooks_common.py
index 64f0f45abc2..61f70a481c7 100644
--- a/zerver/tests/test_webhooks_common.py
+++ b/zerver/tests/test_webhooks_common.py
@@ -202,7 +202,6 @@ class WebhooksCommonTestCase(ZulipTestCase):
class WebhookURLConfigurationTestCase(WebhookTestCase):
WEBHOOK_DIR_NAME = "helloworld"
- URL_TEMPLATE = "/api/v1/external/helloworld?stream={stream}&api_key={api_key}"
@override
def setUp(self) -> None:
diff --git a/zerver/webhooks/airbrake/tests.py b/zerver/webhooks/airbrake/tests.py
index a3726199262..17b1d335e6a 100644
--- a/zerver/webhooks/airbrake/tests.py
+++ b/zerver/webhooks/airbrake/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class AirbrakeHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/airbrake?stream={stream}&api_key={api_key}"
-
def test_airbrake_error_message(self) -> None:
expected_topic_name = "ZulipIntegrationTest"
expected_message = '[ZeroDivisionError](https://zulip.airbrake.io/projects/125209/groups/1705190192091077626): "Error message from logger" occurred.'
diff --git a/zerver/webhooks/airbyte/tests.py b/zerver/webhooks/airbyte/tests.py
index ad9a8b3ac20..cc797359d5d 100644
--- a/zerver/webhooks/airbyte/tests.py
+++ b/zerver/webhooks/airbyte/tests.py
@@ -3,7 +3,6 @@ from zerver.lib.test_classes import WebhookTestCase
class AirbyteHookTests(WebhookTestCase):
STREAM_NAME = "airbyte"
- URL_TEMPLATE = "/api/v1/external/airbyte?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = "airbyte"
def test_airbyte_job_success(self) -> None:
diff --git a/zerver/webhooks/ansibletower/tests.py b/zerver/webhooks/ansibletower/tests.py
index a4c8d6eb3f8..1faeac274a1 100644
--- a/zerver/webhooks/ansibletower/tests.py
+++ b/zerver/webhooks/ansibletower/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class AnsibletowerHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/ansibletower?api_key={api_key}&stream={stream}"
-
def test_ansibletower_project_update_successful_message(self) -> None:
"""
Tests if ansibletower project update successful notification is handled correctly
diff --git a/zerver/webhooks/appfollow/tests.py b/zerver/webhooks/appfollow/tests.py
index 3541460dd68..e3c81e5bc77 100644
--- a/zerver/webhooks/appfollow/tests.py
+++ b/zerver/webhooks/appfollow/tests.py
@@ -3,8 +3,6 @@ from zerver.webhooks.appfollow.view import convert_markdown
class AppFollowHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/appfollow?stream={stream}&api_key={api_key}"
-
def test_sample(self) -> None:
expected_topic_name = "Webhook integration was successful."
expected_message = """Webhook integration was successful.
@@ -33,11 +31,7 @@ Acme enables me to manage the flow of information quite well. I only wish I coul
)
def test_reviews_with_topic(self) -> None:
- # This temporary patch of URL_TEMPLATE is code smell but required due to the way
- # WebhookTestCase is built.
- original_url_template = self.URL_TEMPLATE
- self.URL_TEMPLATE = original_url_template + "&topic=foo"
- self.url = self.build_webhook_url()
+ self.url = self.build_webhook_url() + "&topic=foo"
expected_topic_name = "foo"
expected_message = """Acme - Group chat
App Store, Acme Technologies, Inc.
@@ -52,7 +46,6 @@ Acme enables me to manage the flow of information quite well. I only wish I coul
expected_message,
content_type="application/x-www-form-urlencoded",
)
- self.URL_TEMPLATE = original_url_template
class ConvertMarkdownTest(ZulipTestCase):
diff --git a/zerver/webhooks/appveyor/tests.py b/zerver/webhooks/appveyor/tests.py
index 1ed95cc72bc..871a94cf50e 100644
--- a/zerver/webhooks/appveyor/tests.py
+++ b/zerver/webhooks/appveyor/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class AppveyorHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/appveyor?api_key={api_key}&stream={stream}"
-
def test_appveyor_build_success_message(self) -> None:
"""
Tests if appveyor build success notification is handled correctly
diff --git a/zerver/webhooks/azuredevops/tests.py b/zerver/webhooks/azuredevops/tests.py
index 0a848664b83..ff1cb5d3875 100644
--- a/zerver/webhooks/azuredevops/tests.py
+++ b/zerver/webhooks/azuredevops/tests.py
@@ -5,8 +5,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class AzuredevopsHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/azuredevops?&api_key={api_key}&stream={stream}"
-
def test_push_event_message(self) -> None:
expected_topic_name = "test-zulip / main"
expected_message = "Yuro Itaki [pushed](https://dev.azure.com/ttchong/test-zulip/_git/test-zulip/branchCompare?baseVersion=GC51515957669f93c543df09f8f3e7f47c3613c879&targetVersion=GCb0ce2f2009c3c87dbefadf61d7eb2c0697a6f369&_a=files) 1 commit to branch main.\n\n* Modify readme ([b0ce2f2009c](https://dev.azure.com/ttchong/test-zulip/_git/test-zulip/commit/b0ce2f2009c3c87dbefadf61d7eb2c0697a6f369))"
diff --git a/zerver/webhooks/basecamp/tests.py b/zerver/webhooks/basecamp/tests.py
index ea6f0720e57..1bfbc145d29 100644
--- a/zerver/webhooks/basecamp/tests.py
+++ b/zerver/webhooks/basecamp/tests.py
@@ -4,8 +4,6 @@ TOPIC_NAME = "Zulip HQ"
class BasecampHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/basecamp?stream={stream}&api_key={api_key}"
-
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)."
self._send_and_test_message(
diff --git a/zerver/webhooks/beanstalk/tests.py b/zerver/webhooks/beanstalk/tests.py
index b1b4007e947..729367e17bc 100644
--- a/zerver/webhooks/beanstalk/tests.py
+++ b/zerver/webhooks/beanstalk/tests.py
@@ -7,8 +7,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class BeanstalkHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/beanstalk?stream={stream}"
-
def test_git_single(self) -> None:
expected_topic_name = "work-test / master"
expected_message = """Leo Franchi [pushed](http://lfranchi-svn.beanstalkapp.com/work-test) 1 commit to branch master.
diff --git a/zerver/webhooks/beeminder/tests.py b/zerver/webhooks/beeminder/tests.py
index de58c46a621..483e071d2b4 100644
--- a/zerver/webhooks/beeminder/tests.py
+++ b/zerver/webhooks/beeminder/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class BeeminderHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/beeminder?api_key={api_key}&stream={stream}"
-
@patch("zerver.webhooks.beeminder.view.time.time")
def test_beeminder_derail(self, time: MagicMock) -> None:
time.return_value = 1517739100 # 5.6 hours from fixture value
diff --git a/zerver/webhooks/bitbucket/tests.py b/zerver/webhooks/bitbucket/tests.py
index 89b63163d8d..82273d15d37 100644
--- a/zerver/webhooks/bitbucket/tests.py
+++ b/zerver/webhooks/bitbucket/tests.py
@@ -7,8 +7,6 @@ TOPIC_BRANCH_EVENTS = "Repository name / master"
class BitbucketHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/bitbucket?stream={stream}"
-
def test_bitbucket_on_push_event(self) -> None:
fixture_name = "push"
self.url = self.build_webhook_url(payload=self.get_body(fixture_name))
diff --git a/zerver/webhooks/bitbucket2/tests.py b/zerver/webhooks/bitbucket2/tests.py
index 9bf62a0930a..05c518ac559 100644
--- a/zerver/webhooks/bitbucket2/tests.py
+++ b/zerver/webhooks/bitbucket2/tests.py
@@ -14,8 +14,6 @@ TOPIC_BRANCH_EVENTS = "Repository name / master"
class Bitbucket2HookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/bitbucket2?stream={stream}&api_key={api_key}"
-
def test_bitbucket2_on_push_event(self) -> None:
commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"
expected_message = f"Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 1 commit to branch master.\n\n{commit_info}"
diff --git a/zerver/webhooks/bitbucket3/tests.py b/zerver/webhooks/bitbucket3/tests.py
index 65cc459d1eb..3ae2465dbcd 100644
--- a/zerver/webhooks/bitbucket3/tests.py
+++ b/zerver/webhooks/bitbucket3/tests.py
@@ -5,8 +5,6 @@ TOPIC_BRANCH_EVENTS = "sandbox / {branch}"
class Bitbucket3HookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/bitbucket3?stream={stream}&api_key={api_key}"
-
# Diagnostics events:
def test_ping(self) -> None:
expected_message = (
diff --git a/zerver/webhooks/buildbot/tests.py b/zerver/webhooks/buildbot/tests.py
index 63534301a0f..d16d1923016 100644
--- a/zerver/webhooks/buildbot/tests.py
+++ b/zerver/webhooks/buildbot/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class BuildbotHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/buildbot?api_key={api_key}&stream={stream}"
-
def test_build_started(self) -> None:
expected_topic_name = "buildbot-hello"
expected_message = (
diff --git a/zerver/webhooks/canarytoken/tests.py b/zerver/webhooks/canarytoken/tests.py
index 3d316057ab7..1bc177f023f 100644
--- a/zerver/webhooks/canarytoken/tests.py
+++ b/zerver/webhooks/canarytoken/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class CanarytokensHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/canarytoken?stream={stream}&api_key={api_key}"
-
def test_canarytoken_new(self) -> None:
expected_message = (
"**:alert: Canarytoken has been triggered on <time:2020-06-09T14:04:39+00:00>!**\n\n"
diff --git a/zerver/webhooks/circleci/tests.py b/zerver/webhooks/circleci/tests.py
index 9f41459dabf..ba44f5ef5b0 100644
--- a/zerver/webhooks/circleci/tests.py
+++ b/zerver/webhooks/circleci/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class CircleCiHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/circleci?stream={stream}&api_key={api_key}"
-
def test_ping(self) -> None:
expected_topic_name = "Test event"
expected_message = "Webhook 'Testing' test event successful."
diff --git a/zerver/webhooks/clubhouse/tests.py b/zerver/webhooks/clubhouse/tests.py
index 29cfdbd1644..3503c8b1be6 100644
--- a/zerver/webhooks/clubhouse/tests.py
+++ b/zerver/webhooks/clubhouse/tests.py
@@ -5,8 +5,6 @@ from zerver.lib.test_classes import WebhookTestCase
class ClubhouseWebhookTest(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/clubhouse?stream={stream}&api_key={api_key}"
-
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."
self.check_webhook(
diff --git a/zerver/webhooks/codeship/tests.py b/zerver/webhooks/codeship/tests.py
index 8164a641f60..d06e500d0db 100644
--- a/zerver/webhooks/codeship/tests.py
+++ b/zerver/webhooks/codeship/tests.py
@@ -2,7 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class CodeshipHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/codeship?stream={stream}&api_key={api_key}"
TOPIC_NAME = "codeship/docs"
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 28514e53db5..290657255df 100644
--- a/zerver/webhooks/crashlytics/tests.py
+++ b/zerver/webhooks/crashlytics/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class CrashlyticsHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/crashlytics?stream={stream}&api_key={api_key}"
-
def test_crashlytics_verification_message(self) -> None:
expected_topic_name = "Setup"
expected_message = "Webhook has been successfully configured."
diff --git a/zerver/webhooks/dbt/tests.py b/zerver/webhooks/dbt/tests.py
index f5d1ea94a14..6bdce7ec6b9 100644
--- a/zerver/webhooks/dbt/tests.py
+++ b/zerver/webhooks/dbt/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class DBTHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/dbt?&api_key={api_key}&stream={stream}"
-
def test_dbt_webhook_when_job_started(self) -> None:
expected_message = """:yellow_circle: Daily Job (dbt build) deployment started in **Production**.\n
Job #123 was kicked off from the UI by [email protected] at <time:2023-01-31T19:28:07Z>."""
diff --git a/zerver/webhooks/delighted/tests.py b/zerver/webhooks/delighted/tests.py
index 101bc6c2ce4..0abe4c84858 100644
--- a/zerver/webhooks/delighted/tests.py
+++ b/zerver/webhooks/delighted/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class DelightedHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/delighted?stream={stream}&api_key={api_key}"
-
def test_feedback_message_promoter(self) -> None:
expected_topic_name = "Survey response"
expected_message = """
diff --git a/zerver/webhooks/dropbox/tests.py b/zerver/webhooks/dropbox/tests.py
index abf15a02a9b..430bc0823cb 100644
--- a/zerver/webhooks/dropbox/tests.py
+++ b/zerver/webhooks/dropbox/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class DropboxHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/dropbox?&api_key={api_key}&stream={stream}"
-
def test_file_updated(self) -> None:
expected_topic_name = "Dropbox"
expected_message = "File has been updated on Dropbox!"
diff --git a/zerver/webhooks/errbit/tests.py b/zerver/webhooks/errbit/tests.py
index fde71c64f2a..915973a4737 100644
--- a/zerver/webhooks/errbit/tests.py
+++ b/zerver/webhooks/errbit/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class ErrBitHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/errbit?stream={stream}&api_key={api_key}"
-
def test_errbit_error_message(self) -> None:
expected_topic_name = "ZulipIntegrationTest / ErrbitEnvName"
expected_message = '[IllegalStateException](https://errbit.example.com/apps/5e1ed1ff1a603f3916f4f0de/problems/5e1fe93e1a603f3916f4f0e3): "Invalid state error" occurred.'
diff --git a/zerver/webhooks/flock/tests.py b/zerver/webhooks/flock/tests.py
index a9f1ecc8478..3cb7b9f6f76 100644
--- a/zerver/webhooks/flock/tests.py
+++ b/zerver/webhooks/flock/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class FlockHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/flock?api_key={api_key}&stream={stream}"
-
def test_flock_message(self) -> None:
expected_topic_name = "Flock notifications"
expected_message = "This is the welcome message!"
diff --git a/zerver/webhooks/freshdesk/tests.py b/zerver/webhooks/freshdesk/tests.py
index 6906380f6b8..4e5702dff94 100644
--- a/zerver/webhooks/freshdesk/tests.py
+++ b/zerver/webhooks/freshdesk/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class FreshdeskHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/freshdesk?stream={stream}"
-
def test_ticket_creation(self) -> None:
"""
Messages are generated on ticket creation through Freshdesk's
diff --git a/zerver/webhooks/freshping/tests.py b/zerver/webhooks/freshping/tests.py
index 5d71b2a6c61..2db14e7db00 100644
--- a/zerver/webhooks/freshping/tests.py
+++ b/zerver/webhooks/freshping/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class FreshpingHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/freshping?api_key={api_key}&stream={stream}"
-
def test_freshping_check_test(self) -> None:
"""
Tests if freshping check test is handled correctly
diff --git a/zerver/webhooks/freshstatus/tests.py b/zerver/webhooks/freshstatus/tests.py
index bb7edea8d19..f88c7f20647 100644
--- a/zerver/webhooks/freshstatus/tests.py
+++ b/zerver/webhooks/freshstatus/tests.py
@@ -5,8 +5,6 @@ from zerver.webhooks.freshstatus.view import MISCONFIGURED_PAYLOAD_ERROR_MESSAGE
class FreshstatusHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/freshstatus?api_key={api_key}&stream={stream}"
-
def test_freshstatus_incident_open_multiple_services(self) -> None:
"""
Tests if freshstatus incident open multiple services is handled correctly
diff --git a/zerver/webhooks/front/tests.py b/zerver/webhooks/front/tests.py
index 8eaf86d7a99..bc58cee9a5c 100644
--- a/zerver/webhooks/front/tests.py
+++ b/zerver/webhooks/front/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class FrontHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/front?&api_key={api_key}&stream={stream}"
-
# Scenario 1: Conversation starts from an outbound message.
# Conversation automatically assigned to a teammate who started it.
diff --git a/zerver/webhooks/gitea/tests.py b/zerver/webhooks/gitea/tests.py
index 885f60fa181..2dd81322650 100644
--- a/zerver/webhooks/gitea/tests.py
+++ b/zerver/webhooks/gitea/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class GiteaHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/gitea?&api_key={api_key}&stream={stream}"
-
def test_multiple_commits(self) -> None:
expected_topic_name = "test / d"
expected_message = """kostekIV [pushed](https://try.gitea.io/kostekIV/test/compare/21138d2ca0ce18f8e037696fdbe1b3f0c211f630...2ec0c971d04723523aa20f2b378f8b419b47d4ec) 5 commits to branch d.
diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.py
index 2acfe194f64..e88579662b9 100644
--- a/zerver/webhooks/github/tests.py
+++ b/zerver/webhooks/github/tests.py
@@ -19,8 +19,6 @@ TOPIC_SPONSORS = "sponsors"
class GitHubWebhookTest(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}"
-
def test_ping_event(self) -> None:
expected_message = "GitHub webhook has been successfully configured by TomaszKolek."
self.check_webhook("ping", TOPIC_REPO, expected_message)
diff --git a/zerver/webhooks/gitlab/tests.py b/zerver/webhooks/gitlab/tests.py
index 22ba39fde50..cdcd4acfc90 100644
--- a/zerver/webhooks/gitlab/tests.py
+++ b/zerver/webhooks/gitlab/tests.py
@@ -5,8 +5,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class GitlabHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/gitlab?&api_key={api_key}&stream={stream}"
-
def test_push_event_specified_topic(self) -> None:
self.url = self.build_webhook_url("topic=Specific%20topic")
expected_topic_name = "Specific topic"
diff --git a/zerver/webhooks/gocd/tests.py b/zerver/webhooks/gocd/tests.py
index 03346668104..11e63d89edb 100644
--- a/zerver/webhooks/gocd/tests.py
+++ b/zerver/webhooks/gocd/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class GocdHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/gocd?stream={stream}&api_key={api_key}"
-
def test_building_pipeline(self) -> None:
expected_topic = "Pipeline / Stage"
expected_message = """**Pipeline building**: Pipeline / Stage
diff --git a/zerver/webhooks/gogs/tests.py b/zerver/webhooks/gogs/tests.py
index e3a9c1c52cc..5fbb4c436aa 100644
--- a/zerver/webhooks/gogs/tests.py
+++ b/zerver/webhooks/gogs/tests.py
@@ -5,8 +5,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class GogsHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/gogs?&api_key={api_key}&stream={stream}"
-
def test_push(self) -> None:
expected_topic_name = "try-git / master"
expected_message = """john [pushed](http://localhost:3000/john/try-git/compare/479e6b772b7fba19412457483f50b201286d0103...d8fce16c72a2ff56a5afc8a08645a6ce45491794) 1 commit to branch master. Commits by John (1).
diff --git a/zerver/webhooks/gosquared/tests.py b/zerver/webhooks/gosquared/tests.py
index 8eed0a6e6cb..3c54193dd1d 100644
--- a/zerver/webhooks/gosquared/tests.py
+++ b/zerver/webhooks/gosquared/tests.py
@@ -3,8 +3,6 @@ from zerver.webhooks.gosquared.view import CHAT_MESSAGE_TEMPLATE
class GoSquaredHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/gosquared?stream={stream}&api_key={api_key}"
-
# Note: Include a test function per each distinct message condition your integration supports
def test_traffic_message(self) -> None:
expected_topic_name = "GoSquared - requestb.in"
diff --git a/zerver/webhooks/grafana/tests.py b/zerver/webhooks/grafana/tests.py
index 074a7fec538..84b5d195329 100644
--- a/zerver/webhooks/grafana/tests.py
+++ b/zerver/webhooks/grafana/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class GrafanaHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/grafana?&api_key={api_key}&stream={stream}"
-
def test_alert_v7(self) -> None:
expected_topic_name = "[Alerting] Test notification"
expected_message = """
diff --git a/zerver/webhooks/greenhouse/tests.py b/zerver/webhooks/greenhouse/tests.py
index 131b2ee0880..357ff6c6e36 100644
--- a/zerver/webhooks/greenhouse/tests.py
+++ b/zerver/webhooks/greenhouse/tests.py
@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class GreenhouseHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/greenhouse?stream={stream}&api_key={api_key}"
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 59d758bde4f..9158c0116e7 100644
--- a/zerver/webhooks/groove/tests.py
+++ b/zerver/webhooks/groove/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class GrooveHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/groove?stream={stream}&api_key={api_key}"
-
# This test simulates the condition when a new ticket comes.
def test_groove_ticket_started(self) -> None:
expected_topic_name = "notifications"
diff --git a/zerver/webhooks/harbor/tests.py b/zerver/webhooks/harbor/tests.py
index f45844319b2..096fe21f624 100644
--- a/zerver/webhooks/harbor/tests.py
+++ b/zerver/webhooks/harbor/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class HarborHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/harbor?api_key={api_key}&stream={stream}"
-
def test_push_image(self) -> None:
expected_topic_name = "example/test"
expected_message = """**admin** pushed image `example/test:latest`"""
diff --git a/zerver/webhooks/hellosign/tests.py b/zerver/webhooks/hellosign/tests.py
index 39a68cf7802..a2dc79b5b15 100644
--- a/zerver/webhooks/hellosign/tests.py
+++ b/zerver/webhooks/hellosign/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class HelloSignHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/hellosign?stream={stream}&api_key={api_key}"
-
def test_signatures_message(self) -> None:
expected_topic_name = "NDA with Acme Co."
expected_message = (
diff --git a/zerver/webhooks/helloworld/tests.py b/zerver/webhooks/helloworld/tests.py
index 4396f354912..aa33f6d261d 100644
--- a/zerver/webhooks/helloworld/tests.py
+++ b/zerver/webhooks/helloworld/tests.py
@@ -6,7 +6,6 @@ from zerver.models.users import get_system_bot
class HelloWorldHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}"
DIRECT_MESSAGE_URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}"
# Note: Include a test function per each distinct message condition your integration supports
@@ -36,7 +35,7 @@ class HelloWorldHookTests(WebhookTestCase):
def test_pm_to_bot_owner(self) -> None:
# Note that this is really just a test for check_send_webhook_message
- self.URL_TEMPLATE = self.DIRECT_MESSAGE_URL_TEMPLATE
+ self.url_template = self.DIRECT_MESSAGE_URL_TEMPLATE
self.url = self.build_webhook_url()
expected_message = "Hello! I am happy to be here! :smile:\nThe Wikipedia featured article for today is **[Goodbye](https://en.wikipedia.org/wiki/Goodbye)**"
diff --git a/zerver/webhooks/heroku/tests.py b/zerver/webhooks/heroku/tests.py
index 42ed4b4a876..8e97dfd1b13 100644
--- a/zerver/webhooks/heroku/tests.py
+++ b/zerver/webhooks/heroku/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class HerokuHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/heroku?stream={stream}&api_key={api_key}"
-
def test_deployment(self) -> None:
expected_topic_name = "sample-project"
expected_message = """
diff --git a/zerver/webhooks/homeassistant/tests.py b/zerver/webhooks/homeassistant/tests.py
index b990c1a064e..041c1f69242 100644
--- a/zerver/webhooks/homeassistant/tests.py
+++ b/zerver/webhooks/homeassistant/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class HomeAssistantHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/homeassistant?&api_key={api_key}&stream={stream}"
-
def test_simplereq(self) -> None:
expected_topic_name = "homeassistant"
expected_message = "The sun will be shining today!"
diff --git a/zerver/webhooks/ifttt/tests.py b/zerver/webhooks/ifttt/tests.py
index fb5ce662058..57edf3bacb1 100644
--- a/zerver/webhooks/ifttt/tests.py
+++ b/zerver/webhooks/ifttt/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class IFTTTHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/ifttt?stream={stream}&api_key={api_key}"
-
def test_ifttt_when_subject_and_body_are_correct(self) -> None:
expected_topic_name = "Email sent from [email protected]"
expected_message = "Email subject: Subject"
diff --git a/zerver/webhooks/insping/tests.py b/zerver/webhooks/insping/tests.py
index 5176af2a7cc..438aca23e9d 100644
--- a/zerver/webhooks/insping/tests.py
+++ b/zerver/webhooks/insping/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class InspingHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/insping?&api_key={api_key}&stream={stream}"
-
def test_website_state_available_message(self) -> None:
expected_topic_name = "insping"
expected_message = """
diff --git a/zerver/webhooks/intercom/tests.py b/zerver/webhooks/intercom/tests.py
index 80850fbb806..c1d5d0e3de0 100644
--- a/zerver/webhooks/intercom/tests.py
+++ b/zerver/webhooks/intercom/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class IntercomWebHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/intercom?&api_key={api_key}&stream={stream}"
-
def test_ping(self) -> None:
expected_topic_name = "Intercom"
expected_message = "Intercom webhook has been successfully configured."
diff --git a/zerver/webhooks/jira/tests.py b/zerver/webhooks/jira/tests.py
index 409a43c8d20..80b7c2582a3 100644
--- a/zerver/webhooks/jira/tests.py
+++ b/zerver/webhooks/jira/tests.py
@@ -5,8 +5,6 @@ from zerver.lib.test_classes import WebhookTestCase
class JiraHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/jira?api_key={api_key}&stream={stream}"
-
def test_custom_channel(self) -> None:
api_key = self.test_user.api_key
self.subscribe(self.test_user, "jira_custom")
diff --git a/zerver/webhooks/jotform/tests.py b/zerver/webhooks/jotform/tests.py
index 012baac5684..72a5743f8d6 100644
--- a/zerver/webhooks/jotform/tests.py
+++ b/zerver/webhooks/jotform/tests.py
@@ -5,8 +5,6 @@ from zerver.lib.webhooks.common import parse_multipart_string
class JotformHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/jotform?stream={stream}&api_key={api_key}"
-
def test_response(self) -> None:
expected_title = "Tutor Appointment Form"
expected_message = """
diff --git a/zerver/webhooks/json/tests.py b/zerver/webhooks/json/tests.py
index ecd992fd44f..22fed3ddf06 100644
--- a/zerver/webhooks/json/tests.py
+++ b/zerver/webhooks/json/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class JsonHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/json?api_key={api_key}&stream={stream}"
-
def test_json_github_push__1_commit_message(self) -> None:
"""
Tests if json github push 1 commit is handled correctly
diff --git a/zerver/webhooks/librato/tests.py b/zerver/webhooks/librato/tests.py
index ac8df5db7ad..053699285a1 100644
--- a/zerver/webhooks/librato/tests.py
+++ b/zerver/webhooks/librato/tests.py
@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCase
class LibratoHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/librato?api_key={api_key}&stream={stream}"
IS_ATTACHMENT = False
@override
diff --git a/zerver/webhooks/lidarr/tests.py b/zerver/webhooks/lidarr/tests.py
index 50ebd21aef6..cba17489452 100644
--- a/zerver/webhooks/lidarr/tests.py
+++ b/zerver/webhooks/lidarr/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class LidarrHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/lidarr?api_key={api_key}&stream={stream}"
-
def test_lidarr_test(self) -> None:
"""
Tests if lidarr test payload is handled correctly
diff --git a/zerver/webhooks/linear/tests.py b/zerver/webhooks/linear/tests.py
index 5f3523235b2..f8a9a79585f 100644
--- a/zerver/webhooks/linear/tests.py
+++ b/zerver/webhooks/linear/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class LinearHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/linear?&api_key={api_key}&stream={stream}"
-
def test_issue_create_simple_without_description(self) -> None:
expected_topic_name = "Issue: Drop-down overflow in the select menu."
expected_message = "[Issue](https://linear.app/webhooks/issue/WEB-42/drop-down-overflow-in-the-select-menu) was created in team Webhooks.\nPriority: High, Status: Todo."
diff --git a/zerver/webhooks/mention/tests.py b/zerver/webhooks/mention/tests.py
index 7a4aa4feec6..ab1a3144a63 100644
--- a/zerver/webhooks/mention/tests.py
+++ b/zerver/webhooks/mention/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class MentionHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/mention?api_key={api_key}&stream={stream}"
-
def test_mention_webfeed(self) -> None:
expected_topic_name = "news"
expected_message = """
diff --git a/zerver/webhooks/netlify/tests.py b/zerver/webhooks/netlify/tests.py
index 7b46fe9e1e7..bb541d0b3cd 100644
--- a/zerver/webhooks/netlify/tests.py
+++ b/zerver/webhooks/netlify/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class NetlifyHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/netlify?stream={stream}&api_key={api_key}"
-
def test_building_message(self) -> None:
expected_topic_name = "master"
expected_message = "The build [objective-jepsen-35fbb2](http://objective-jepsen-35fbb2.netlify.com) on branch master is now building."
diff --git a/zerver/webhooks/newrelic/tests.py b/zerver/webhooks/newrelic/tests.py
index 58310d93541..80c925b68be 100644
--- a/zerver/webhooks/newrelic/tests.py
+++ b/zerver/webhooks/newrelic/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class NewRelicHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/newrelic?stream={stream}&api_key={api_key}"
-
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..."
expected_message = """
diff --git a/zerver/webhooks/opencollective/tests.py b/zerver/webhooks/opencollective/tests.py
index dc958ed662a..d88c78abe02 100644
--- a/zerver/webhooks/opencollective/tests.py
+++ b/zerver/webhooks/opencollective/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class OpenCollectiveHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/opencollective?&api_key={api_key}&stream={stream}"
-
# Note: Include a test function per each distinct message condition your integration supports
def test_one_time_donation(self) -> None: # test one time donation
expected_topic_name = "New Member"
diff --git a/zerver/webhooks/openproject/tests.py b/zerver/webhooks/openproject/tests.py
index 4a07a20f56c..237fec3d39c 100644
--- a/zerver/webhooks/openproject/tests.py
+++ b/zerver/webhooks/openproject/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class OpenProjectHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/openproject?api_key={api_key}&stream={stream}"
-
def test_project_with_parent_created(self) -> None:
expected_topic = "AI Backend"
expected_message = (
diff --git a/zerver/webhooks/opensearch/tests.py b/zerver/webhooks/opensearch/tests.py
index 64f22e36bda..d7f0f5c8e6f 100644
--- a/zerver/webhooks/opensearch/tests.py
+++ b/zerver/webhooks/opensearch/tests.py
@@ -5,7 +5,6 @@ from zerver.lib.test_classes import WebhookTestCase
class OpensearchHookTests(WebhookTestCase):
TOPIC_NAME = "OpenSearch alerts"
- URL_TEMPLATE = "/api/v1/external/opensearch?stream={stream}&api_key={api_key}"
@override
def setUp(self) -> None:
diff --git a/zerver/webhooks/opsgenie/tests.py b/zerver/webhooks/opsgenie/tests.py
index 3270126cfb2..ae8b2559bde 100644
--- a/zerver/webhooks/opsgenie/tests.py
+++ b/zerver/webhooks/opsgenie/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class OpsgenieHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/opsgenie?&api_key={api_key}&stream={stream}"
-
def test_acknowledge_alert(self) -> None:
expected_topic_name = "Integration1"
expected_message = """
diff --git a/zerver/webhooks/pagerduty/tests.py b/zerver/webhooks/pagerduty/tests.py
index 39f727f8a57..cc6982ad29b 100644
--- a/zerver/webhooks/pagerduty/tests.py
+++ b/zerver/webhooks/pagerduty/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class PagerDutyHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/pagerduty?api_key={api_key}&stream={stream}"
-
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```"
self.check_webhook("trigger", "Incident 3", expected_message)
diff --git a/zerver/webhooks/papertrail/tests.py b/zerver/webhooks/papertrail/tests.py
index 957428088b4..c432f153cf8 100644
--- a/zerver/webhooks/papertrail/tests.py
+++ b/zerver/webhooks/papertrail/tests.py
@@ -6,8 +6,6 @@ from zerver.lib.test_classes import WebhookTestCase
class PapertrailHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/papertrail?&api_key={api_key}&stream={stream}"
-
def test_short_message(self) -> None:
expected_topic_name = "logs"
expected_message = """
diff --git a/zerver/webhooks/patreon/tests.py b/zerver/webhooks/patreon/tests.py
index 7a0defcc13a..b21603e83eb 100644
--- a/zerver/webhooks/patreon/tests.py
+++ b/zerver/webhooks/patreon/tests.py
@@ -13,8 +13,6 @@ IGNORED_EVENTS = [
class PatreonHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/patreon?&api_key={api_key}&stream={stream}"
-
def test_patreon_members_create(self) -> None:
expected_message = "Kopi has joined as a member!"
self.check_webhook(
diff --git a/zerver/webhooks/pingdom/tests.py b/zerver/webhooks/pingdom/tests.py
index e06aea32ee3..feb2fd72e3b 100644
--- a/zerver/webhooks/pingdom/tests.py
+++ b/zerver/webhooks/pingdom/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class PingdomHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/pingdom?stream={stream}&api_key={api_key}"
-
def test_pingdom_from_up_to_down_http_check_message(self) -> None:
"""
Tests if pingdom http check from up to down is handled correctly
diff --git a/zerver/webhooks/pivotal/tests.py b/zerver/webhooks/pivotal/tests.py
index c7fae382e03..7a5605baa5e 100644
--- a/zerver/webhooks/pivotal/tests.py
+++ b/zerver/webhooks/pivotal/tests.py
@@ -9,8 +9,6 @@ from zerver.webhooks.pivotal.view import api_pivotal_webhook_v5
class PivotalV3HookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/pivotal?stream={stream}&api_key={api_key}"
-
def test_accepted(self) -> None:
expected_topic_name = "My new Feature story"
expected_message = 'Leo Franchi accepted "My new Feature story" \
@@ -110,8 +108,6 @@ class PivotalV3HookTests(WebhookTestCase):
class PivotalV5HookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/pivotal?stream={stream}&api_key={api_key}"
-
def test_accepted(self) -> None:
expected_topic_name = "#63486316: Story of the Year"
expected_message = """Leo Franchi updated [Hard Code](https://www.pivotaltracker.com/s/projects/807213): [Story of the Year](http://www.pivotaltracker.com/story/show/63486316):
diff --git a/zerver/webhooks/radarr/tests.py b/zerver/webhooks/radarr/tests.py
index 5b9d076df79..c059cd457f3 100644
--- a/zerver/webhooks/radarr/tests.py
+++ b/zerver/webhooks/radarr/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class RadarrHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/radarr?api_key={api_key}&stream={stream}"
-
def test_radarr_test(self) -> None:
"""
Tests if radarr test payload is handled correctly
diff --git a/zerver/webhooks/raygun/tests.py b/zerver/webhooks/raygun/tests.py
index c3702a9e3e4..df94a475d79 100644
--- a/zerver/webhooks/raygun/tests.py
+++ b/zerver/webhooks/raygun/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class RaygunHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/raygun?&api_key={api_key}&stream={stream}"
-
def test_status_changed_message(self) -> None:
expected_topic_name = "test"
expected_message = """
diff --git a/zerver/webhooks/reviewboard/tests.py b/zerver/webhooks/reviewboard/tests.py
index 27425689373..f49d3ee5e2c 100644
--- a/zerver/webhooks/reviewboard/tests.py
+++ b/zerver/webhooks/reviewboard/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class ReviewBoardHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/reviewboard?&api_key={api_key}&stream={stream}"
-
def test_review_request_published(self) -> None:
expected_topic_name = "Scheduler"
expected_message = "**eeshangarg** opened [#2: Initial commit](https://rbcommons.com/s/zulip/r/2/):\n\n``` quote\n**Description**: Initial commit\n**Status**: pending\n**Target people**: **drsbgarg**\n**Branch**: master\n```"
diff --git a/zerver/webhooks/rhodecode/tests.py b/zerver/webhooks/rhodecode/tests.py
index db9d00f0807..0583ff05372 100644
--- a/zerver/webhooks/rhodecode/tests.py
+++ b/zerver/webhooks/rhodecode/tests.py
@@ -5,8 +5,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class RhodecodeHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/rhodecode?&api_key={api_key}&stream={stream}"
-
def test_push_event_message(self) -> None:
expected_topic_name = "u/yuroitaki/zulip-testing / master"
expected_message = "yuroitaki pushed 1 commit to branch master. Commits by Yuro Itaki <[email protected]> (1).\n\n* Modify README ([2b8c0ebf507](https://code.rhodecode.com/u/yuroitaki/zulip-testing/changeset/2b8c0ebf50710bc2e1cdb6a33071dd2435ad667c))"
diff --git a/zerver/webhooks/rundeck/tests.py b/zerver/webhooks/rundeck/tests.py
index f44fe53f307..5a014d5d472 100644
--- a/zerver/webhooks/rundeck/tests.py
+++ b/zerver/webhooks/rundeck/tests.py
@@ -3,7 +3,6 @@ from zerver.lib.test_classes import WebhookTestCase
class RundeckHookTests(WebhookTestCase):
TOPIC_NAME = "Global Log Filter Usage"
- URL_TEMPLATE = "/api/v1/external/rundeck?&api_key={api_key}&stream={stream}"
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 660b6d2e171..1ec43eb9901 100644
--- a/zerver/webhooks/semaphore/tests.py
+++ b/zerver/webhooks/semaphore/tests.py
@@ -6,8 +6,6 @@ from zerver.lib.test_classes import WebhookTestCase
class SemaphoreHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/semaphore?stream={stream}&api_key={api_key}"
-
# 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
# details about the build, deploy, server, author, and commit
diff --git a/zerver/webhooks/sentry/tests.py b/zerver/webhooks/sentry/tests.py
index e93636b7b1c..069e158e67f 100644
--- a/zerver/webhooks/sentry/tests.py
+++ b/zerver/webhooks/sentry/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class SentryHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/sentry?&api_key={api_key}&stream={stream}"
-
def test_event_for_exception_golang(self) -> None:
expected_topic_name = '*url.Error: Get "bad_url": unsupported protocol scheme ""'
expected_message = """\
diff --git a/zerver/webhooks/slack/tests.py b/zerver/webhooks/slack/tests.py
index 52c44bbf5ad..679a006a117 100644
--- a/zerver/webhooks/slack/tests.py
+++ b/zerver/webhooks/slack/tests.py
@@ -411,8 +411,6 @@ class SlackWebhookTests(WebhookTestCase):
class SlackLegacyWebhookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/slack?stream={stream}&api_key={api_key}"
-
def test_slack_only_stream_parameter(self) -> None:
expected_topic_name = "Message from Slack"
expected_message = EXPECTED_MESSAGE.format(user=LEGACY_USER, message="test")
diff --git a/zerver/webhooks/slack_incoming/tests.py b/zerver/webhooks/slack_incoming/tests.py
index 379df90f254..50bb1a53012 100644
--- a/zerver/webhooks/slack_incoming/tests.py
+++ b/zerver/webhooks/slack_incoming/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class SlackIncomingHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/slack_incoming?&api_key={api_key}&stream={stream}"
-
def test_message(self) -> None:
expected_topic_name = ""
expected_message = """
diff --git a/zerver/webhooks/sonarqube/tests.py b/zerver/webhooks/sonarqube/tests.py
index 3d0a8cb6064..2a210e30b97 100644
--- a/zerver/webhooks/sonarqube/tests.py
+++ b/zerver/webhooks/sonarqube/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class SonarqubeHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/sonarqube?api_key={api_key}&stream={stream}"
-
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 bfec1022959..2c799832614 100644
--- a/zerver/webhooks/sonarr/tests.py
+++ b/zerver/webhooks/sonarr/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class SonarrHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/sonarr?api_key={api_key}&stream={stream}"
-
def test_sonarr_test(self) -> None:
"""
Tests if sonarr test payload is handled correctly
diff --git a/zerver/webhooks/splunk/tests.py b/zerver/webhooks/splunk/tests.py
index b5634aff38a..15f68fd87d2 100644
--- a/zerver/webhooks/splunk/tests.py
+++ b/zerver/webhooks/splunk/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class SplunkHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/splunk?api_key={api_key}&stream={stream}"
-
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 93919fe92cf..ff7d12346af 100644
--- a/zerver/webhooks/statuspage/tests.py
+++ b/zerver/webhooks/statuspage/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class StatuspageHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/statuspage?api_key={api_key}&stream={stream}"
-
def test_statuspage_incident(self) -> None:
expected_topic_name = "Database query delays: All Systems Operational"
expected_message = """
diff --git a/zerver/webhooks/stripe/tests.py b/zerver/webhooks/stripe/tests.py
index 1ff59fbeb58..27553cc0e5c 100644
--- a/zerver/webhooks/stripe/tests.py
+++ b/zerver/webhooks/stripe/tests.py
@@ -5,8 +5,6 @@ from zerver.lib.test_classes import WebhookTestCase
class StripeHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/stripe?&api_key={api_key}&stream={stream}"
-
def test_charge_dispute_closed(self) -> None:
expected_topic_name = "disputes"
expected_message = "[Dispute](https://dashboard.stripe.com/disputes/dp_00000000000000) closed. Current status: won."
diff --git a/zerver/webhooks/taiga/tests.py b/zerver/webhooks/taiga/tests.py
index bf12809acb6..c436ce239ee 100644
--- a/zerver/webhooks/taiga/tests.py
+++ b/zerver/webhooks/taiga/tests.py
@@ -5,7 +5,6 @@ from zerver.lib.test_classes import WebhookTestCase
class TaigaHookTests(WebhookTestCase):
TOPIC_NAME = "subject"
- URL_TEMPLATE = "/api/v1/external/taiga?stream={stream}&api_key={api_key}"
@override
def setUp(self) -> None:
diff --git a/zerver/webhooks/teamcity/tests.py b/zerver/webhooks/teamcity/tests.py
index f48bb455ec5..88aaed0f65c 100644
--- a/zerver/webhooks/teamcity/tests.py
+++ b/zerver/webhooks/teamcity/tests.py
@@ -9,7 +9,6 @@ from zerver.webhooks.teamcity.view import MISCONFIGURED_PAYLOAD_TYPE_ERROR_MESSA
class TeamCityHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/teamcity?stream={stream}&api_key={api_key}"
TOPIC_NAME = "Project :: Compile"
def test_teamcity_success(self) -> None:
diff --git a/zerver/webhooks/thinkst/tests.py b/zerver/webhooks/thinkst/tests.py
index 2ba31de4e68..3aa32a22891 100644
--- a/zerver/webhooks/thinkst/tests.py
+++ b/zerver/webhooks/thinkst/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class ThinkstHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/thinkst?stream={stream}&api_key={api_key}"
-
def test_canary_dummy(self) -> None:
expected_message = (
"**:alert: Canary *0000000testnode* has been triggered!**\n\n"
diff --git a/zerver/webhooks/transifex/tests.py b/zerver/webhooks/transifex/tests.py
index 0f7c34ba9ed..f1f594596af 100644
--- a/zerver/webhooks/transifex/tests.py
+++ b/zerver/webhooks/transifex/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class TransifexHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/transifex?stream={stream}&api_key={api_key}"
-
PROJECT = "project-title"
LANGUAGE = "en"
RESOURCE = "file"
diff --git a/zerver/webhooks/travis/tests.py b/zerver/webhooks/travis/tests.py
index 552fcfa7c18..375bc723563 100644
--- a/zerver/webhooks/travis/tests.py
+++ b/zerver/webhooks/travis/tests.py
@@ -6,7 +6,6 @@ from zerver.lib.test_classes import WebhookTestCase
class TravisHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/travis?stream={stream}&api_key={api_key}"
TOPIC_NAME = "builds"
EXPECTED_MESSAGE = """
Author: josh_mandel
diff --git a/zerver/webhooks/trello/tests.py b/zerver/webhooks/trello/tests.py
index f1439d258d9..5e88be59c45 100644
--- a/zerver/webhooks/trello/tests.py
+++ b/zerver/webhooks/trello/tests.py
@@ -6,8 +6,6 @@ from zerver.lib.test_classes import WebhookTestCase
class TrelloHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/trello?stream={stream}&api_key={api_key}"
-
def test_trello_confirmation_request(self) -> None:
response = self.client_head(self.build_webhook_url())
self.assertEqual(response.status_code, 200, response)
diff --git a/zerver/webhooks/updown/tests.py b/zerver/webhooks/updown/tests.py
index 2af648b1911..2124fc1e3e6 100644
--- a/zerver/webhooks/updown/tests.py
+++ b/zerver/webhooks/updown/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class UpdownHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/updown?stream={stream}&api_key={api_key}"
-
def test_updown_check_down_event(self) -> None:
expected_topic_name = "https://updown.io"
expected_message = (
diff --git a/zerver/webhooks/uptimerobot/tests.py b/zerver/webhooks/uptimerobot/tests.py
index f3f1d42eaeb..39d7432ab6d 100644
--- a/zerver/webhooks/uptimerobot/tests.py
+++ b/zerver/webhooks/uptimerobot/tests.py
@@ -5,8 +5,6 @@ from zerver.webhooks.uptimerobot.view import MISCONFIGURED_PAYLOAD_ERROR_MESSAGE
class UptimeRobotHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/uptimerobot?stream={stream}&api_key={api_key}"
-
def test_uptimerobot_monitor_down(self) -> None:
"""
Tests if uptimerobot monitor down is handled correctly
diff --git a/zerver/webhooks/wekan/tests.py b/zerver/webhooks/wekan/tests.py
index 4998d487f46..5dcc1d27496 100644
--- a/zerver/webhooks/wekan/tests.py
+++ b/zerver/webhooks/wekan/tests.py
@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class WekanHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/wekan?stream={stream}&api_key={api_key}"
FIXTURE_DIR_NAME = "wekan"
def test_add_attachment_message(self) -> None:
diff --git a/zerver/webhooks/wordpress/tests.py b/zerver/webhooks/wordpress/tests.py
index b427d355428..0df4e685d84 100644
--- a/zerver/webhooks/wordpress/tests.py
+++ b/zerver/webhooks/wordpress/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class WordPressHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/wordpress?api_key={api_key}&stream={stream}"
-
def test_publish_post(self) -> None:
expected_topic_name = "WordPress Post"
expected_message = "New post published:\n* [New Blog Post](http://example.com\n)"
diff --git a/zerver/webhooks/zabbix/tests.py b/zerver/webhooks/zabbix/tests.py
index 13ca0eed9e8..ad4fbb5450c 100644
--- a/zerver/webhooks/zabbix/tests.py
+++ b/zerver/webhooks/zabbix/tests.py
@@ -5,8 +5,6 @@ from zerver.webhooks.zabbix.view import MISCONFIGURED_PAYLOAD_ERROR_MESSAGE
class ZabbixHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/zabbix?api_key={api_key}&stream={stream}"
-
def test_zabbix_alert_message(self) -> None:
"""
Tests if zabbix alert is handled correctly
diff --git a/zerver/webhooks/zapier/tests.py b/zerver/webhooks/zapier/tests.py
index c75cd134c8f..1cf46f22f02 100644
--- a/zerver/webhooks/zapier/tests.py
+++ b/zerver/webhooks/zapier/tests.py
@@ -2,8 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class ZapierHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/zapier?stream={stream}&api_key={api_key}"
-
def test_zapier_when_subject_and_body_are_correct(self) -> None:
expected_topic_name = "New email from [email protected]"
expected_message = "Your email content is: \nMy Email content."
@@ -23,8 +21,6 @@ class ZapierHookTests(WebhookTestCase):
class ZapierZulipAppTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/zapier?api_key={api_key}&stream={stream}"
-
def test_auth(self) -> None:
payload = self.get_body("zapier_zulip_app_auth")
result = self.client_post(self.url, payload, content_type="application/json")
diff --git a/zerver/webhooks/zendesk/tests.py b/zerver/webhooks/zendesk/tests.py
index f8fb49f8400..1b5d6d609d6 100644
--- a/zerver/webhooks/zendesk/tests.py
+++ b/zerver/webhooks/zendesk/tests.py
@@ -4,8 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class ZenDeskHookTests(WebhookTestCase):
- URL_TEMPLATE = "/api/v1/external/zendesk?stream={stream}"
-
@override
def get_payload(self, fixture_name: str) -> dict[str, str]:
return {