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: Remove CHANNEL_NAME from test classes.

Niloth P83d0946b34d8
diff --git a/api_docs/incoming-webhooks-walkthrough.md b/api_docs/incoming-webhooks-walkthrough.md
index b53c7aff5c0..e13428a7cd6 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):
- 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}"
@@ -428,20 +427,12 @@ class HelloWorldHookTests(WebhookTestCase):
)
```
-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,
-`check_webhook` will create it while executing your test.
-
-If your test expects a channel name from a test fixture, the value in the fixture
-and the value you set for `CHANNEL_NAME` must match. The test helpers use `CHANNEL_NAME`
-to create the destination channel, and then create the message to send using the
-value from the fixture. If these don't match, the test will fail.
-
-`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.
+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
@@ -613,10 +604,10 @@ def test_unknown_action_no_data(self) -> None:
# return if no params are sent. The fixture for this test is an empty file.
# subscribe to the target channel
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
# post to the webhook url
- post_params = {'stream_name': self.CHANNEL_NAME,
+ post_params = {'stream_name': self.channel_name,
'content_type': 'application/x-www-form-urlencoded'}
result = self.client_post(self.url, 'unknown_action', **post_params)
@@ -629,9 +620,9 @@ and then check that the incoming webhook's response matches the expected result.
the webhook returns an error, the test fails. Instead, explicitly do the
setup it would have done, and check the result yourself.
-Here, `subscribe_to_stream` is a test helper that uses `TEST_USER_EMAIL` and
-`CHANNEL_NAME` (attributes from the base class) to register the user to receive
-messages in the given channel. If the channel doesn't exist, it creates it.
+Here, `subscribe` is a test helper that uses `test_user` and `channel_name`
+(attributes from the base class) to register the user to receive messages in
+the given channel. If the channel doesn't exist, it creates it.
`client_post`, another helper, performs the HTTP POST that calls the incoming
webhook. As long as `self.url` is correct, you don't need to construct the webhook
@@ -674,7 +665,6 @@ attribute `TOPIC` as a keyword argument to `build_webhook_url`, like so:
```python
class QuerytestHookTests(WebhookTestCase):
- CHANNEL_NAME = 'querytest'
TOPIC = "Default topic"
URL_TEMPLATE = "/api/v1/external/querytest?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = 'querytest'
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py
index f3f1f36d245..9bf95c80a1a 100644
--- a/zerver/lib/test_classes.py
+++ b/zerver/lib/test_classes.py
@@ -2465,7 +2465,6 @@ class WebhookTestCase(ZulipTestCase):
supported event types.
"""
- CHANNEL_NAME: str | None = None
TEST_USER_EMAIL = "[email protected]"
URL_TEMPLATE: str
WEBHOOK_DIR_NAME: str | None = None
@@ -2480,8 +2479,9 @@ class WebhookTestCase(ZulipTestCase):
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()
+ self.channel_name = self.webhook_dir_name
+ self.url = self.build_webhook_url()
function = import_string(
f"zerver.webhooks.{self.webhook_dir_name}.view.api_{self.webhook_dir_name}_webhook"
@@ -2559,7 +2559,7 @@ You can fix this by adding "{complete_event_type}" to ALL_EVENT_TYPES for this w
We use `fixture_name` to find the payload data in of our test
fixtures. Then we verify that a message gets sent to a stream:
- self.CHANNEL_NAME: stream name
+ self.channel_name: stream name
expected_topic_name: topic name
expected_message: content
@@ -2571,8 +2571,7 @@ You can fix this by adding "{complete_event_type}" to ALL_EVENT_TYPES for this w
When no message is expected to be sent, set `expect_noop` to True.
"""
- assert self.CHANNEL_NAME is not None
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
payload = self.get_payload(fixture_name)
if content_type is not None:
@@ -2607,7 +2606,7 @@ one or more new messages.
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=expected_topic_name,
content=expected_message,
)
@@ -2663,9 +2662,9 @@ one or more new messages.
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)
+ 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.format(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 2525af7a637..64f0f45abc2 100644
--- a/zerver/tests/test_webhooks_common.py
+++ b/zerver/tests/test_webhooks_common.py
@@ -201,25 +201,24 @@ class WebhooksCommonTestCase(ZulipTestCase):
class WebhookURLConfigurationTestCase(WebhookTestCase):
- CHANNEL_NAME = "helloworld"
WEBHOOK_DIR_NAME = "helloworld"
URL_TEMPLATE = "/api/v1/external/helloworld?stream={stream}&api_key={api_key}"
@override
def setUp(self) -> None:
super().setUp()
- stream = self.subscribe(self.test_user, self.CHANNEL_NAME)
+ stream = self.subscribe(self.test_user, self.channel_name)
# In actual webhook tests, we will not need to use stream id.
- # We assign stream id to CHANNEL_NAME for testing URL configuration only.
- self.CHANNEL_NAME = str(stream.id)
+ # We assign stream id to channel_name for testing URL configuration only.
+ self.channel_name = str(stream.id)
do_rename_stream(stream, "helloworld_renamed", self.test_user)
self.url = self.build_webhook_url()
def test_trigger_stream_message_by_id(self) -> None:
# check_webhook cannot be used here as it
- # subscribes the test user to self.CHANNEL_NAME
+ # subscribes the test user to self.channel_name
payload = self.get_body("hello")
self.send_webhook_payload(
@@ -239,14 +238,13 @@ 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
def test_missing_event_header(self) -> None:
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
with self.assertNoLogs("zulip.zerver.webhooks.anomalous", level="INFO"):
result = self.client_post(
self.url,
diff --git a/zerver/webhooks/airbrake/tests.py b/zerver/webhooks/airbrake/tests.py
index c4bd751b3e6..a3726199262 100644
--- a/zerver/webhooks/airbrake/tests.py
+++ b/zerver/webhooks/airbrake/tests.py
@@ -2,7 +2,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}"
def test_airbrake_error_message(self) -> None:
diff --git a/zerver/webhooks/airbyte/tests.py b/zerver/webhooks/airbyte/tests.py
index 7bca8e6a3b7..ad9a8b3ac20 100644
--- a/zerver/webhooks/airbyte/tests.py
+++ b/zerver/webhooks/airbyte/tests.py
@@ -5,7 +5,6 @@ class AirbyteHookTests(WebhookTestCase):
STREAM_NAME = "airbyte"
URL_TEMPLATE = "/api/v1/external/airbyte?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = "airbyte"
- CHANNEL_NAME = "test"
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 0f6cac4f057..6e9fda076ba 100644
--- a/zerver/webhooks/alertmanager/tests.py
+++ b/zerver/webhooks/alertmanager/tests.py
@@ -2,7 +2,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"
def test_error_issue_message(self) -> None:
diff --git a/zerver/webhooks/ansibletower/tests.py b/zerver/webhooks/ansibletower/tests.py
index 09e2b96bb8c..a4c8d6eb3f8 100644
--- a/zerver/webhooks/ansibletower/tests.py
+++ b/zerver/webhooks/ansibletower/tests.py
@@ -2,7 +2,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}"
def test_ansibletower_project_update_successful_message(self) -> None:
diff --git a/zerver/webhooks/appfollow/tests.py b/zerver/webhooks/appfollow/tests.py
index 87625dd6a04..3541460dd68 100644
--- a/zerver/webhooks/appfollow/tests.py
+++ b/zerver/webhooks/appfollow/tests.py
@@ -3,7 +3,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}"
def test_sample(self) -> None:
diff --git a/zerver/webhooks/appveyor/tests.py b/zerver/webhooks/appveyor/tests.py
index 4932fb003ad..1ed95cc72bc 100644
--- a/zerver/webhooks/appveyor/tests.py
+++ b/zerver/webhooks/appveyor/tests.py
@@ -2,7 +2,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}"
def test_appveyor_build_success_message(self) -> None:
diff --git a/zerver/webhooks/azuredevops/tests.py b/zerver/webhooks/azuredevops/tests.py
index d9d9d0c8eae..0a848664b83 100644
--- a/zerver/webhooks/azuredevops/tests.py
+++ b/zerver/webhooks/azuredevops/tests.py
@@ -5,7 +5,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}"
def test_push_event_message(self) -> None:
diff --git a/zerver/webhooks/basecamp/tests.py b/zerver/webhooks/basecamp/tests.py
index 3cd1047c7b5..ea6f0720e57 100644
--- a/zerver/webhooks/basecamp/tests.py
+++ b/zerver/webhooks/basecamp/tests.py
@@ -4,7 +4,6 @@ TOPIC_NAME = "Zulip HQ"
class BasecampHookTests(WebhookTestCase):
- CHANNEL_NAME = "basecamp"
URL_TEMPLATE = "/api/v1/external/basecamp?stream={stream}&api_key={api_key}"
def test_basecamp_makes_doc_active(self) -> None:
diff --git a/zerver/webhooks/beanstalk/tests.py b/zerver/webhooks/beanstalk/tests.py
index 02bffe5af94..b1b4007e947 100644
--- a/zerver/webhooks/beanstalk/tests.py
+++ b/zerver/webhooks/beanstalk/tests.py
@@ -7,7 +7,6 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class BeanstalkHookTests(WebhookTestCase):
- CHANNEL_NAME = "commits"
URL_TEMPLATE = "/api/v1/external/beanstalk?stream={stream}"
def test_git_single(self) -> None:
diff --git a/zerver/webhooks/beeminder/tests.py b/zerver/webhooks/beeminder/tests.py
index b1bea67176a..de58c46a621 100644
--- a/zerver/webhooks/beeminder/tests.py
+++ b/zerver/webhooks/beeminder/tests.py
@@ -4,7 +4,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}"
@patch("zerver.webhooks.beeminder.view.time.time")
diff --git a/zerver/webhooks/bitbucket/tests.py b/zerver/webhooks/bitbucket/tests.py
index 5f639f050d6..89b63163d8d 100644
--- a/zerver/webhooks/bitbucket/tests.py
+++ b/zerver/webhooks/bitbucket/tests.py
@@ -7,7 +7,6 @@ TOPIC_BRANCH_EVENTS = "Repository name / master"
class BitbucketHookTests(WebhookTestCase):
- CHANNEL_NAME = "bitbucket"
URL_TEMPLATE = "/api/v1/external/bitbucket?stream={stream}"
def test_bitbucket_on_push_event(self) -> None:
diff --git a/zerver/webhooks/bitbucket2/tests.py b/zerver/webhooks/bitbucket2/tests.py
index 40270ff9145..9bf62a0930a 100644
--- a/zerver/webhooks/bitbucket2/tests.py
+++ b/zerver/webhooks/bitbucket2/tests.py
@@ -14,7 +14,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}"
def test_bitbucket2_on_push_event(self) -> None:
@@ -277,7 +276,7 @@ class Bitbucket2HookTests(WebhookTestCase):
def test_bitbucket2_on_push_more_than_one_tag_event(self) -> None:
expected_message = "Tomasz pushed tag [{name}](https://bitbucket.org/kolaszek/repository-name/commits/tag/{name})."
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
payload = self.get_body("push_more_than_one_tag")
msg = self.send_webhook_payload(
@@ -291,7 +290,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_second_to_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=TOPIC,
content=expected_message.format(name="a"),
)
@@ -299,13 +298,13 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=TOPIC,
content=expected_message.format(name="b"),
)
def test_bitbucket2_on_more_than_one_push_event(self) -> None:
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
payload = self.get_body("more_than_one_push_event")
msg = self.send_webhook_payload(
@@ -319,7 +318,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_second_to_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=TOPIC_BRANCH_EVENTS,
content="Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 1 commit to branch master.\n\n* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))",
)
@@ -327,7 +326,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=TOPIC,
content="Tomasz pushed tag [a](https://bitbucket.org/kolaszek/repository-name/commits/tag/a).",
)
@@ -335,7 +334,7 @@ class Bitbucket2HookTests(WebhookTestCase):
def test_bitbucket2_on_more_than_one_push_event_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url(branches="master,development")
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
payload = self.get_body("more_than_one_push_event")
msg = self.send_webhook_payload(
@@ -349,7 +348,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_second_to_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=TOPIC_BRANCH_EVENTS,
content="Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 1 commit to branch master.\n\n* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))",
)
@@ -357,7 +356,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=TOPIC,
content="Tomasz pushed tag [a](https://bitbucket.org/kolaszek/repository-name/commits/tag/a).",
)
diff --git a/zerver/webhooks/bitbucket3/tests.py b/zerver/webhooks/bitbucket3/tests.py
index e72481f3046..65cc459d1eb 100644
--- a/zerver/webhooks/bitbucket3/tests.py
+++ b/zerver/webhooks/bitbucket3/tests.py
@@ -5,7 +5,6 @@ TOPIC_BRANCH_EVENTS = "sandbox / {branch}"
class Bitbucket3HookTests(WebhookTestCase):
- CHANNEL_NAME = "bitbucket3"
URL_TEMPLATE = "/api/v1/external/bitbucket3?stream={stream}&api_key={api_key}"
# Diagnostics events:
@@ -80,7 +79,7 @@ class Bitbucket3HookTests(WebhookTestCase):
branch1_content = """[hypro999](http://139.59.64.214:7990/users/hypro999) pushed to branch branch1. Head is now 3980c2be32a7e23c795741d5dc1a2eecb9b85d6d."""
master_content = """[hypro999](http://139.59.64.214:7990/users/hypro999) pushed to branch master. Head is now fc43d13cff1abb28631196944ba4fc4ad06a2cf2."""
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
payload = self.get_body("repo_push_update_multiple_branches")
msg = self.send_webhook_payload(
@@ -93,7 +92,7 @@ class Bitbucket3HookTests(WebhookTestCase):
msg = self.get_second_to_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=TOPIC_BRANCH_EVENTS.format(branch="branch1"),
content=branch1_content,
)
@@ -101,7 +100,7 @@ class Bitbucket3HookTests(WebhookTestCase):
msg = self.get_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=TOPIC_BRANCH_EVENTS.format(branch="master"),
content=master_content,
)
diff --git a/zerver/webhooks/buildbot/tests.py b/zerver/webhooks/buildbot/tests.py
index da776d05063..63534301a0f 100644
--- a/zerver/webhooks/buildbot/tests.py
+++ b/zerver/webhooks/buildbot/tests.py
@@ -2,7 +2,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}"
def test_build_started(self) -> None:
diff --git a/zerver/webhooks/canarytoken/tests.py b/zerver/webhooks/canarytoken/tests.py
index 06d7a772c0f..3d316057ab7 100644
--- a/zerver/webhooks/canarytoken/tests.py
+++ b/zerver/webhooks/canarytoken/tests.py
@@ -2,7 +2,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}"
def test_canarytoken_new(self) -> None:
diff --git a/zerver/webhooks/circleci/tests.py b/zerver/webhooks/circleci/tests.py
index 3a69231eae4..9f41459dabf 100644
--- a/zerver/webhooks/circleci/tests.py
+++ b/zerver/webhooks/circleci/tests.py
@@ -2,7 +2,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}"
def test_ping(self) -> None:
diff --git a/zerver/webhooks/clubhouse/tests.py b/zerver/webhooks/clubhouse/tests.py
index c9c9c6d80e7..29cfdbd1644 100644
--- a/zerver/webhooks/clubhouse/tests.py
+++ b/zerver/webhooks/clubhouse/tests.py
@@ -5,7 +5,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}"
def test_story_create(self) -> None:
diff --git a/zerver/webhooks/codeship/tests.py b/zerver/webhooks/codeship/tests.py
index c8e408015c1..8164a641f60 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):
- CHANNEL_NAME = "codeship"
URL_TEMPLATE = "/api/v1/external/codeship?stream={stream}&api_key={api_key}"
TOPIC_NAME = "codeship/docs"
diff --git a/zerver/webhooks/crashlytics/tests.py b/zerver/webhooks/crashlytics/tests.py
index 4100741fd8f..28514e53db5 100644
--- a/zerver/webhooks/crashlytics/tests.py
+++ b/zerver/webhooks/crashlytics/tests.py
@@ -2,7 +2,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}"
def test_crashlytics_verification_message(self) -> None:
diff --git a/zerver/webhooks/dbt/tests.py b/zerver/webhooks/dbt/tests.py
index 605073696db..f5d1ea94a14 100644
--- a/zerver/webhooks/dbt/tests.py
+++ b/zerver/webhooks/dbt/tests.py
@@ -2,7 +2,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}"
def test_dbt_webhook_when_job_started(self) -> None:
@@ -27,7 +26,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"
def test_dbt_webhook_with_valid_access_url(self) -> None:
diff --git a/zerver/webhooks/delighted/tests.py b/zerver/webhooks/delighted/tests.py
index 10648f8f342..101bc6c2ce4 100644
--- a/zerver/webhooks/delighted/tests.py
+++ b/zerver/webhooks/delighted/tests.py
@@ -2,7 +2,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}"
def test_feedback_message_promoter(self) -> None:
diff --git a/zerver/webhooks/dropbox/tests.py b/zerver/webhooks/dropbox/tests.py
index 6e77d6996a2..abf15a02a9b 100644
--- a/zerver/webhooks/dropbox/tests.py
+++ b/zerver/webhooks/dropbox/tests.py
@@ -2,7 +2,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}"
def test_file_updated(self) -> None:
@@ -17,8 +16,8 @@ class DropboxHookTests(WebhookTestCase):
)
def test_verification_request(self) -> None:
- self.subscribe(self.test_user, self.CHANNEL_NAME)
- get_params = {"stream_name": self.CHANNEL_NAME, "api_key": self.test_user.api_key}
+ self.subscribe(self.test_user, self.channel_name)
+ get_params = {"stream_name": self.channel_name, "api_key": self.test_user.api_key}
result = self.client_get(self.url, get_params)
self.assert_json_error(result, "Missing 'challenge' argument", 400)
diff --git a/zerver/webhooks/errbit/tests.py b/zerver/webhooks/errbit/tests.py
index 08fe281b6ce..fde71c64f2a 100644
--- a/zerver/webhooks/errbit/tests.py
+++ b/zerver/webhooks/errbit/tests.py
@@ -2,7 +2,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}"
def test_errbit_error_message(self) -> None:
diff --git a/zerver/webhooks/flock/tests.py b/zerver/webhooks/flock/tests.py
index 380e160c326..a9f1ecc8478 100644
--- a/zerver/webhooks/flock/tests.py
+++ b/zerver/webhooks/flock/tests.py
@@ -2,7 +2,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}"
def test_flock_message(self) -> None:
diff --git a/zerver/webhooks/freshdesk/tests.py b/zerver/webhooks/freshdesk/tests.py
index a827c6d1b9e..6906380f6b8 100644
--- a/zerver/webhooks/freshdesk/tests.py
+++ b/zerver/webhooks/freshdesk/tests.py
@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class FreshdeskHookTests(WebhookTestCase):
- CHANNEL_NAME = "freshdesk"
URL_TEMPLATE = "/api/v1/external/freshdesk?stream={stream}"
def test_ticket_creation(self) -> None:
diff --git a/zerver/webhooks/freshping/tests.py b/zerver/webhooks/freshping/tests.py
index 4fc32ae7ca8..5d71b2a6c61 100644
--- a/zerver/webhooks/freshping/tests.py
+++ b/zerver/webhooks/freshping/tests.py
@@ -2,7 +2,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}"
def test_freshping_check_test(self) -> None:
diff --git a/zerver/webhooks/freshstatus/tests.py b/zerver/webhooks/freshstatus/tests.py
index f015a2fab1f..bb7edea8d19 100644
--- a/zerver/webhooks/freshstatus/tests.py
+++ b/zerver/webhooks/freshstatus/tests.py
@@ -5,7 +5,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}"
def test_freshstatus_incident_open_multiple_services(self) -> None:
diff --git a/zerver/webhooks/front/tests.py b/zerver/webhooks/front/tests.py
index c98b92d6c2f..8eaf86d7a99 100644
--- a/zerver/webhooks/front/tests.py
+++ b/zerver/webhooks/front/tests.py
@@ -4,7 +4,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}"
# Scenario 1: Conversation starts from an outbound message.
diff --git a/zerver/webhooks/gitea/tests.py b/zerver/webhooks/gitea/tests.py
index 5ecca957628..885f60fa181 100644
--- a/zerver/webhooks/gitea/tests.py
+++ b/zerver/webhooks/gitea/tests.py
@@ -4,7 +4,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}"
def test_multiple_commits(self) -> None:
diff --git a/zerver/webhooks/github/tests.py b/zerver/webhooks/github/tests.py
index f65b4d60778..2acfe194f64 100644
--- a/zerver/webhooks/github/tests.py
+++ b/zerver/webhooks/github/tests.py
@@ -19,7 +19,6 @@ TOPIC_SPONSORS = "sponsors"
class GitHubWebhookTest(WebhookTestCase):
- CHANNEL_NAME = "github"
URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}"
def test_ping_event(self) -> None:
@@ -640,7 +639,7 @@ A temporary team so that I can get some webhook fixtures!
self.verify_post_is_ignored(payload, event)
def test_team_edited_with_unsupported_keys(self) -> None:
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
event = "team"
payload = dict(
@@ -665,7 +664,7 @@ A temporary team so that I can get some webhook fixtures!
self.assert_channel_message(
message=channel_message,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name="team My Team",
content="Team has changes to `bogus_key1/bogus_key2` data.",
)
@@ -775,7 +774,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}"
def test_cancelled_message(self) -> None:
diff --git a/zerver/webhooks/gitlab/tests.py b/zerver/webhooks/gitlab/tests.py
index a6303bb9aa9..22ba39fde50 100644
--- a/zerver/webhooks/gitlab/tests.py
+++ b/zerver/webhooks/gitlab/tests.py
@@ -5,7 +5,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}"
def test_push_event_specified_topic(self) -> None:
diff --git a/zerver/webhooks/gocd/tests.py b/zerver/webhooks/gocd/tests.py
index eac342392b5..03346668104 100644
--- a/zerver/webhooks/gocd/tests.py
+++ b/zerver/webhooks/gocd/tests.py
@@ -2,7 +2,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}"
def test_building_pipeline(self) -> None:
diff --git a/zerver/webhooks/gogs/tests.py b/zerver/webhooks/gogs/tests.py
index 801c647b244..e3a9c1c52cc 100644
--- a/zerver/webhooks/gogs/tests.py
+++ b/zerver/webhooks/gogs/tests.py
@@ -5,7 +5,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}"
def test_push(self) -> None:
diff --git a/zerver/webhooks/gosquared/tests.py b/zerver/webhooks/gosquared/tests.py
index 1f46c614f2e..8eed0a6e6cb 100644
--- a/zerver/webhooks/gosquared/tests.py
+++ b/zerver/webhooks/gosquared/tests.py
@@ -3,7 +3,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}"
# Note: Include a test function per each distinct message condition your integration supports
diff --git a/zerver/webhooks/grafana/tests.py b/zerver/webhooks/grafana/tests.py
index 823caa4dc10..074a7fec538 100644
--- a/zerver/webhooks/grafana/tests.py
+++ b/zerver/webhooks/grafana/tests.py
@@ -2,7 +2,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}"
def test_alert_v7(self) -> None:
@@ -207,7 +206,7 @@ Annotations:
[Silence](https://play.grafana.org/alerting/silence/new?alertmanager=grafana&matchers=alertname%3DT1%2Cteam%3Dblue%2Czone%3Deu-1)
""".strip()
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
payload = self.get_body("alert_multiple_v8")
msg = self.send_webhook_payload(
@@ -220,7 +219,7 @@ Annotations:
msg = self.get_second_to_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=expected_topic_name_1,
content=expected_message_1,
)
@@ -228,7 +227,7 @@ Annotations:
msg = self.get_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=expected_topic_name_2,
content=expected_message_2,
)
diff --git a/zerver/webhooks/greenhouse/tests.py b/zerver/webhooks/greenhouse/tests.py
index 44425a13644..131b2ee0880 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):
- CHANNEL_NAME = "greenhouse"
URL_TEMPLATE = "/api/v1/external/greenhouse?stream={stream}&api_key={api_key}"
CONTENT_TYPE = "application/x-www-form-urlencoded"
diff --git a/zerver/webhooks/groove/tests.py b/zerver/webhooks/groove/tests.py
index e663f9e43ed..59d758bde4f 100644
--- a/zerver/webhooks/groove/tests.py
+++ b/zerver/webhooks/groove/tests.py
@@ -2,7 +2,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}"
# This test simulates the condition when a new ticket comes.
@@ -63,7 +62,7 @@ The content of the body goes here.
# This simulates the condition when a ticket
# is assigned to no one.
def test_groove_ticket_assigned_no_one(self) -> None:
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
result = self.client_post(
self.url,
self.get_body("ticket_assigned__no_one"),
diff --git a/zerver/webhooks/harbor/tests.py b/zerver/webhooks/harbor/tests.py
index 865753db47a..f45844319b2 100644
--- a/zerver/webhooks/harbor/tests.py
+++ b/zerver/webhooks/harbor/tests.py
@@ -4,7 +4,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}"
def test_push_image(self) -> None:
diff --git a/zerver/webhooks/hellosign/tests.py b/zerver/webhooks/hellosign/tests.py
index bd3b4daac2f..39a68cf7802 100644
--- a/zerver/webhooks/hellosign/tests.py
+++ b/zerver/webhooks/hellosign/tests.py
@@ -4,7 +4,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}"
def test_signatures_message(self) -> None:
diff --git a/zerver/webhooks/helloworld/tests.py b/zerver/webhooks/helloworld/tests.py
index 53e55bc6b2f..4396f354912 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):
- 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}"
@@ -49,7 +48,7 @@ class HelloWorldHookTests(WebhookTestCase):
def test_stream_error_pm_to_bot_owner(self) -> None:
# Note that this is really just a test for check_send_webhook_message
- self.CHANNEL_NAME = "nonexistent"
+ self.channel_name = "nonexistent"
self.url = self.build_webhook_url()
realm = get_realm("zulip")
notification_bot = get_system_bot(settings.NOTIFICATION_BOT, realm.id)
diff --git a/zerver/webhooks/heroku/tests.py b/zerver/webhooks/heroku/tests.py
index 0162a9709f8..42ed4b4a876 100644
--- a/zerver/webhooks/heroku/tests.py
+++ b/zerver/webhooks/heroku/tests.py
@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class HerokuHookTests(WebhookTestCase):
- CHANNEL_NAME = "heroku"
URL_TEMPLATE = "/api/v1/external/heroku?stream={stream}&api_key={api_key}"
def test_deployment(self) -> None:
diff --git a/zerver/webhooks/homeassistant/tests.py b/zerver/webhooks/homeassistant/tests.py
index 29f4fbd0a15..b990c1a064e 100644
--- a/zerver/webhooks/homeassistant/tests.py
+++ b/zerver/webhooks/homeassistant/tests.py
@@ -2,7 +2,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}"
def test_simplereq(self) -> None:
diff --git a/zerver/webhooks/ifttt/tests.py b/zerver/webhooks/ifttt/tests.py
index f04548bc006..fb5ce662058 100644
--- a/zerver/webhooks/ifttt/tests.py
+++ b/zerver/webhooks/ifttt/tests.py
@@ -2,7 +2,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}"
def test_ifttt_when_subject_and_body_are_correct(self) -> None:
diff --git a/zerver/webhooks/insping/tests.py b/zerver/webhooks/insping/tests.py
index 70ad1c0cf49..5176af2a7cc 100644
--- a/zerver/webhooks/insping/tests.py
+++ b/zerver/webhooks/insping/tests.py
@@ -2,7 +2,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}"
def test_website_state_available_message(self) -> None:
diff --git a/zerver/webhooks/intercom/tests.py b/zerver/webhooks/intercom/tests.py
index 7599a9c1d44..80850fbb806 100644
--- a/zerver/webhooks/intercom/tests.py
+++ b/zerver/webhooks/intercom/tests.py
@@ -2,7 +2,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}"
def test_ping(self) -> None:
diff --git a/zerver/webhooks/jira/tests.py b/zerver/webhooks/jira/tests.py
index 7e373458c19..409a43c8d20 100644
--- a/zerver/webhooks/jira/tests.py
+++ b/zerver/webhooks/jira/tests.py
@@ -5,7 +5,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}"
def test_custom_channel(self) -> None:
@@ -63,9 +62,9 @@ Leo Franchi created [BUG-15: New bug with hook](http://lfranchi.com:8080/browse/
self.assert_json_success(result)
def test_created_with_channel_with_spaces_escaped(self) -> None:
- self.CHANNEL_NAME = quote("jira alerts")
+ self.channel_name = quote("jira alerts")
self.url = self.build_webhook_url()
- self.subscribe(self.test_user, unquote(self.CHANNEL_NAME))
+ self.subscribe(self.test_user, unquote(self.channel_name))
payload = self.get_body("created_v1")
result = self.client_post(self.url, payload, content_type="application/json")
@@ -84,9 +83,9 @@ Leo Franchi created [BUG-15: New bug with hook](http://lfranchi.com:8080/browse/
self.assertEqual(msg.topic_name(), expected_topic_name)
def test_created_with_channel_with_spaces_double_escaped(self) -> None:
- self.CHANNEL_NAME = quote(quote("jira alerts"))
+ self.channel_name = quote(quote("jira alerts"))
self.url = self.build_webhook_url()
- self.subscribe(self.test_user, unquote(unquote(self.CHANNEL_NAME)))
+ self.subscribe(self.test_user, unquote(unquote(self.channel_name)))
payload = self.get_body("created_v1")
result = self.client_post(self.url, payload, content_type="application/json")
diff --git a/zerver/webhooks/jotform/tests.py b/zerver/webhooks/jotform/tests.py
index a5917c09768..012baac5684 100644
--- a/zerver/webhooks/jotform/tests.py
+++ b/zerver/webhooks/jotform/tests.py
@@ -5,7 +5,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}"
def test_response(self) -> None:
diff --git a/zerver/webhooks/json/tests.py b/zerver/webhooks/json/tests.py
index 04065fb8c34..ecd992fd44f 100644
--- a/zerver/webhooks/json/tests.py
+++ b/zerver/webhooks/json/tests.py
@@ -4,7 +4,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}"
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 3b0ad794fa0..ac8df5db7ad 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):
- CHANNEL_NAME = "librato"
URL_TEMPLATE = "/api/v1/external/librato?api_key={api_key}&stream={stream}"
IS_ATTACHMENT = False
diff --git a/zerver/webhooks/lidarr/tests.py b/zerver/webhooks/lidarr/tests.py
index c73c100f9ba..50ebd21aef6 100644
--- a/zerver/webhooks/lidarr/tests.py
+++ b/zerver/webhooks/lidarr/tests.py
@@ -2,7 +2,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}"
def test_lidarr_test(self) -> None:
diff --git a/zerver/webhooks/linear/tests.py b/zerver/webhooks/linear/tests.py
index 0fceee01b78..5f3523235b2 100644
--- a/zerver/webhooks/linear/tests.py
+++ b/zerver/webhooks/linear/tests.py
@@ -2,7 +2,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}"
def test_issue_create_simple_without_description(self) -> None:
diff --git a/zerver/webhooks/mention/tests.py b/zerver/webhooks/mention/tests.py
index a69a84a6fab..7a4aa4feec6 100644
--- a/zerver/webhooks/mention/tests.py
+++ b/zerver/webhooks/mention/tests.py
@@ -2,7 +2,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}"
def test_mention_webfeed(self) -> None:
diff --git a/zerver/webhooks/netlify/tests.py b/zerver/webhooks/netlify/tests.py
index 22274137ff5..7b46fe9e1e7 100644
--- a/zerver/webhooks/netlify/tests.py
+++ b/zerver/webhooks/netlify/tests.py
@@ -2,7 +2,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}"
def test_building_message(self) -> None:
diff --git a/zerver/webhooks/newrelic/tests.py b/zerver/webhooks/newrelic/tests.py
index 8ee603793c9..58310d93541 100644
--- a/zerver/webhooks/newrelic/tests.py
+++ b/zerver/webhooks/newrelic/tests.py
@@ -2,7 +2,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}"
def test_incident_activated_new_default_payload(self) -> None:
diff --git a/zerver/webhooks/opencollective/tests.py b/zerver/webhooks/opencollective/tests.py
index 2e24bc0e65d..dc958ed662a 100644
--- a/zerver/webhooks/opencollective/tests.py
+++ b/zerver/webhooks/opencollective/tests.py
@@ -2,7 +2,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}"
# Note: Include a test function per each distinct message condition your integration supports
diff --git a/zerver/webhooks/openproject/tests.py b/zerver/webhooks/openproject/tests.py
index f8465bbd6a2..4a07a20f56c 100644
--- a/zerver/webhooks/openproject/tests.py
+++ b/zerver/webhooks/openproject/tests.py
@@ -2,7 +2,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}"
def test_project_with_parent_created(self) -> None:
diff --git a/zerver/webhooks/opensearch/tests.py b/zerver/webhooks/opensearch/tests.py
index 2f524482b9b..64f22e36bda 100644
--- a/zerver/webhooks/opensearch/tests.py
+++ b/zerver/webhooks/opensearch/tests.py
@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class OpensearchHookTests(WebhookTestCase):
- CHANNEL_NAME = "Opensearch Alerts"
TOPIC_NAME = "OpenSearch alerts"
URL_TEMPLATE = "/api/v1/external/opensearch?stream={stream}&api_key={api_key}"
diff --git a/zerver/webhooks/opsgenie/tests.py b/zerver/webhooks/opsgenie/tests.py
index 287f968e929..3270126cfb2 100644
--- a/zerver/webhooks/opsgenie/tests.py
+++ b/zerver/webhooks/opsgenie/tests.py
@@ -2,7 +2,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}"
def test_acknowledge_alert(self) -> None:
diff --git a/zerver/webhooks/pagerduty/tests.py b/zerver/webhooks/pagerduty/tests.py
index 6fb85c7d11b..39f727f8a57 100644
--- a/zerver/webhooks/pagerduty/tests.py
+++ b/zerver/webhooks/pagerduty/tests.py
@@ -2,7 +2,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}"
def test_trigger(self) -> None:
diff --git a/zerver/webhooks/papertrail/tests.py b/zerver/webhooks/papertrail/tests.py
index f4b633099dc..957428088b4 100644
--- a/zerver/webhooks/papertrail/tests.py
+++ b/zerver/webhooks/papertrail/tests.py
@@ -6,7 +6,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}"
def test_short_message(self) -> None:
diff --git a/zerver/webhooks/patreon/tests.py b/zerver/webhooks/patreon/tests.py
index 55c21576936..7a0defcc13a 100644
--- a/zerver/webhooks/patreon/tests.py
+++ b/zerver/webhooks/patreon/tests.py
@@ -13,7 +13,6 @@ IGNORED_EVENTS = [
class PatreonHookTests(WebhookTestCase):
- CHANNEL_NAME = "Patreon"
URL_TEMPLATE = "/api/v1/external/patreon?&api_key={api_key}&stream={stream}"
def test_patreon_members_create(self) -> None:
diff --git a/zerver/webhooks/pingdom/tests.py b/zerver/webhooks/pingdom/tests.py
index e3058e1f476..e06aea32ee3 100644
--- a/zerver/webhooks/pingdom/tests.py
+++ b/zerver/webhooks/pingdom/tests.py
@@ -2,7 +2,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}"
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 f3de6149ca9..c7fae382e03 100644
--- a/zerver/webhooks/pivotal/tests.py
+++ b/zerver/webhooks/pivotal/tests.py
@@ -9,7 +9,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}"
def test_accepted(self) -> None:
@@ -111,7 +110,6 @@ class PivotalV3HookTests(WebhookTestCase):
class PivotalV5HookTests(WebhookTestCase):
- CHANNEL_NAME = "pivotal"
URL_TEMPLATE = "/api/v1/external/pivotal?stream={stream}&api_key={api_key}"
def test_accepted(self) -> None:
diff --git a/zerver/webhooks/radarr/tests.py b/zerver/webhooks/radarr/tests.py
index ff480fb0d96..5b9d076df79 100644
--- a/zerver/webhooks/radarr/tests.py
+++ b/zerver/webhooks/radarr/tests.py
@@ -2,7 +2,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}"
def test_radarr_test(self) -> None:
diff --git a/zerver/webhooks/raygun/tests.py b/zerver/webhooks/raygun/tests.py
index ff006b9f255..c3702a9e3e4 100644
--- a/zerver/webhooks/raygun/tests.py
+++ b/zerver/webhooks/raygun/tests.py
@@ -2,7 +2,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}"
def test_status_changed_message(self) -> None:
diff --git a/zerver/webhooks/reviewboard/tests.py b/zerver/webhooks/reviewboard/tests.py
index d8e589dc532..27425689373 100644
--- a/zerver/webhooks/reviewboard/tests.py
+++ b/zerver/webhooks/reviewboard/tests.py
@@ -2,7 +2,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}"
def test_review_request_published(self) -> None:
diff --git a/zerver/webhooks/rhodecode/tests.py b/zerver/webhooks/rhodecode/tests.py
index 7288f0d977d..db9d00f0807 100644
--- a/zerver/webhooks/rhodecode/tests.py
+++ b/zerver/webhooks/rhodecode/tests.py
@@ -5,7 +5,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}"
def test_push_event_message(self) -> None:
diff --git a/zerver/webhooks/rundeck/tests.py b/zerver/webhooks/rundeck/tests.py
index e90f56faf44..f44fe53f307 100644
--- a/zerver/webhooks/rundeck/tests.py
+++ b/zerver/webhooks/rundeck/tests.py
@@ -2,7 +2,6 @@ from zerver.lib.test_classes import WebhookTestCase
class RundeckHookTests(WebhookTestCase):
- CHANNEL_NAME = "Rundeck"
TOPIC_NAME = "Global Log Filter Usage"
URL_TEMPLATE = "/api/v1/external/rundeck?&api_key={api_key}&stream={stream}"
diff --git a/zerver/webhooks/semaphore/tests.py b/zerver/webhooks/semaphore/tests.py
index a657373ee7c..660b6d2e171 100644
--- a/zerver/webhooks/semaphore/tests.py
+++ b/zerver/webhooks/semaphore/tests.py
@@ -6,7 +6,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}"
# Messages are generated by Semaphore on git push. The subject lines below
diff --git a/zerver/webhooks/sentry/tests.py b/zerver/webhooks/sentry/tests.py
index 387f9bfbdcf..e93636b7b1c 100644
--- a/zerver/webhooks/sentry/tests.py
+++ b/zerver/webhooks/sentry/tests.py
@@ -2,7 +2,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}"
def test_event_for_exception_golang(self) -> None:
diff --git a/zerver/webhooks/slack/tests.py b/zerver/webhooks/slack/tests.py
index cd440fb7282..52c44bbf5ad 100644
--- a/zerver/webhooks/slack/tests.py
+++ b/zerver/webhooks/slack/tests.py
@@ -46,7 +46,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"
@mock_slack_api_calls
@@ -97,7 +96,7 @@ class SlackWebhookTests(WebhookTestCase):
@mock_slack_api_calls
def test_slack_channels_map_to_topics_false(self) -> None:
- self.CHANNEL_NAME = API_CHANNEL_NAME
+ self.channel_name = API_CHANNEL_NAME
self.url = self.build_webhook_url(channels_map_to_topics="0")
expected_message = EXPECTED_MESSAGE.format(user=USER, message=MESSAGE_WITH_NORMAL_TEXT)
self.check_webhook(
@@ -109,7 +108,7 @@ class SlackWebhookTests(WebhookTestCase):
@mock_slack_api_calls
def test_url_options_channels_mapping_true(self) -> None:
- self.CHANNEL_NAME = API_CHANNEL_NAME
+ self.channel_name = API_CHANNEL_NAME
self.url = self.build_webhook_url(mapping="channels")
expected_message = EXPECTED_MESSAGE.format(user=USER, message=MESSAGE_WITH_NORMAL_TEXT)
expected_topic_name = DEFAULT_TOPIC_NAME
@@ -122,7 +121,7 @@ class SlackWebhookTests(WebhookTestCase):
@mock_slack_api_calls
def test_slack_channels_map_to_topics_false_and_user_specified_topic(self) -> None:
- self.CHANNEL_NAME = API_CHANNEL_NAME
+ self.channel_name = API_CHANNEL_NAME
expected_topic_name = "test"
self.url = self.build_webhook_url(topic=expected_topic_name, channels_map_to_topics="0")
expected_message = EXPECTED_MESSAGE.format(user=USER, message=MESSAGE_WITH_NORMAL_TEXT)
@@ -135,7 +134,7 @@ class SlackWebhookTests(WebhookTestCase):
@mock_slack_api_calls
def test_url_options_map_to_channels_and_user_specified_topic(self) -> None:
- self.CHANNEL_NAME = API_CHANNEL_NAME
+ self.channel_name = API_CHANNEL_NAME
expected_topic_name = DEFAULT_TOPIC_NAME
self.url = self.build_webhook_url(topic=expected_topic_name, mapping="channels")
expected_message = EXPECTED_MESSAGE.format(user=USER, message=MESSAGE_WITH_NORMAL_TEXT)
@@ -412,7 +411,6 @@ class SlackWebhookTests(WebhookTestCase):
class SlackLegacyWebhookTests(WebhookTestCase):
- CHANNEL_NAME = "slack"
URL_TEMPLATE = "/api/v1/external/slack?stream={stream}&api_key={api_key}"
def test_slack_only_stream_parameter(self) -> None:
@@ -459,7 +457,7 @@ class SlackLegacyWebhookTests(WebhookTestCase):
)
def test_slack_channels_map_to_topics_false(self) -> None:
- self.CHANNEL_NAME = "general"
+ self.channel_name = "general"
self.url = self.build_webhook_url(channels_map_to_topics="0")
expected_topic_name = "Message from Slack"
expected_message = EXPECTED_MESSAGE.format(user=LEGACY_USER, message="test")
@@ -471,7 +469,7 @@ class SlackLegacyWebhookTests(WebhookTestCase):
)
def test_slack_channels_map_to_topics_false_and_user_specified_topic(self) -> None:
- self.CHANNEL_NAME = "general"
+ self.channel_name = "general"
self.url = self.build_webhook_url(topic="test", channels_map_to_topics="0")
expected_topic_name = "test"
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 872e78008ca..379df90f254 100644
--- a/zerver/webhooks/slack_incoming/tests.py
+++ b/zerver/webhooks/slack_incoming/tests.py
@@ -4,7 +4,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}"
def test_message(self) -> None:
@@ -27,7 +26,7 @@ Hello, world.
("*foo*a*bar*", "*foo*a*bar*"),
("some _foo_ word", "some *foo* word"),
]
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
for input_value, output_value in tests:
payload = {"text": input_value}
msg = self.send_webhook_payload(
@@ -38,7 +37,7 @@ Hello, world.
)
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name="",
content=output_value,
)
diff --git a/zerver/webhooks/sonarqube/tests.py b/zerver/webhooks/sonarqube/tests.py
index 5bdbe6a8c2a..3d0a8cb6064 100644
--- a/zerver/webhooks/sonarqube/tests.py
+++ b/zerver/webhooks/sonarqube/tests.py
@@ -2,7 +2,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}"
def test_analysis_success(self) -> None:
diff --git a/zerver/webhooks/sonarr/tests.py b/zerver/webhooks/sonarr/tests.py
index f34b0ef62e6..bfec1022959 100644
--- a/zerver/webhooks/sonarr/tests.py
+++ b/zerver/webhooks/sonarr/tests.py
@@ -2,7 +2,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}"
def test_sonarr_test(self) -> None:
diff --git a/zerver/webhooks/splunk/tests.py b/zerver/webhooks/splunk/tests.py
index de9e65ecde7..b5634aff38a 100644
--- a/zerver/webhooks/splunk/tests.py
+++ b/zerver/webhooks/splunk/tests.py
@@ -2,7 +2,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}"
def test_splunk_search_one_result(self) -> None:
diff --git a/zerver/webhooks/statuspage/tests.py b/zerver/webhooks/statuspage/tests.py
index 07dc28c8253..93919fe92cf 100644
--- a/zerver/webhooks/statuspage/tests.py
+++ b/zerver/webhooks/statuspage/tests.py
@@ -2,7 +2,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}"
def test_statuspage_incident(self) -> None:
diff --git a/zerver/webhooks/stripe/tests.py b/zerver/webhooks/stripe/tests.py
index 66c49c59a6a..1ff59fbeb58 100644
--- a/zerver/webhooks/stripe/tests.py
+++ b/zerver/webhooks/stripe/tests.py
@@ -5,7 +5,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}"
def test_charge_dispute_closed(self) -> None:
diff --git a/zerver/webhooks/taiga/tests.py b/zerver/webhooks/taiga/tests.py
index a3ee5570f51..bf12809acb6 100644
--- a/zerver/webhooks/taiga/tests.py
+++ b/zerver/webhooks/taiga/tests.py
@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class TaigaHookTests(WebhookTestCase):
- CHANNEL_NAME = "taiga"
TOPIC_NAME = "subject"
URL_TEMPLATE = "/api/v1/external/taiga?stream={stream}&api_key={api_key}"
diff --git a/zerver/webhooks/teamcity/tests.py b/zerver/webhooks/teamcity/tests.py
index f525a163394..f48bb455ec5 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):
- CHANNEL_NAME = "teamcity"
URL_TEMPLATE = "/api/v1/external/teamcity?stream={stream}&api_key={api_key}"
TOPIC_NAME = "Project :: Compile"
diff --git a/zerver/webhooks/thinkst/tests.py b/zerver/webhooks/thinkst/tests.py
index 64740ee5a69..2ba31de4e68 100644
--- a/zerver/webhooks/thinkst/tests.py
+++ b/zerver/webhooks/thinkst/tests.py
@@ -2,7 +2,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}"
def test_canary_dummy(self) -> None:
diff --git a/zerver/webhooks/transifex/tests.py b/zerver/webhooks/transifex/tests.py
index 11b8cf39d75..0f7c34ba9ed 100644
--- a/zerver/webhooks/transifex/tests.py
+++ b/zerver/webhooks/transifex/tests.py
@@ -4,7 +4,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}"
PROJECT = "project-title"
diff --git a/zerver/webhooks/travis/tests.py b/zerver/webhooks/travis/tests.py
index e66d96b0061..552fcfa7c18 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):
- CHANNEL_NAME = "travis"
URL_TEMPLATE = "/api/v1/external/travis?stream={stream}&api_key={api_key}"
TOPIC_NAME = "builds"
EXPECTED_MESSAGE = """
diff --git a/zerver/webhooks/trello/tests.py b/zerver/webhooks/trello/tests.py
index 4c40bdfd939..f1439d258d9 100644
--- a/zerver/webhooks/trello/tests.py
+++ b/zerver/webhooks/trello/tests.py
@@ -6,7 +6,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}"
def test_trello_confirmation_request(self) -> None:
diff --git a/zerver/webhooks/updown/tests.py b/zerver/webhooks/updown/tests.py
index b7e4dab3b62..2af648b1911 100644
--- a/zerver/webhooks/updown/tests.py
+++ b/zerver/webhooks/updown/tests.py
@@ -2,7 +2,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}"
def test_updown_check_down_event(self) -> None:
@@ -30,7 +29,7 @@ class UpdownHookTests(WebhookTestCase):
)
up_content = "Service is `up` again after 1 second."
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
payload = self.get_body("check_multiple_events")
msg = self.send_webhook_payload(
@@ -43,7 +42,7 @@ class UpdownHookTests(WebhookTestCase):
msg = self.get_second_to_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=topic_name,
content=down_content,
)
@@ -51,7 +50,7 @@ class UpdownHookTests(WebhookTestCase):
msg = self.get_last_message()
self.assert_channel_message(
message=msg,
- channel_name=self.CHANNEL_NAME,
+ channel_name=self.channel_name,
topic_name=topic_name,
content=up_content,
)
diff --git a/zerver/webhooks/uptimerobot/tests.py b/zerver/webhooks/uptimerobot/tests.py
index 158da404463..f3f1d42eaeb 100644
--- a/zerver/webhooks/uptimerobot/tests.py
+++ b/zerver/webhooks/uptimerobot/tests.py
@@ -5,7 +5,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}"
def test_uptimerobot_monitor_down(self) -> None:
diff --git a/zerver/webhooks/wekan/tests.py b/zerver/webhooks/wekan/tests.py
index da7694393b9..4998d487f46 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):
- CHANNEL_NAME = "wekan"
URL_TEMPLATE = "/api/v1/external/wekan?stream={stream}&api_key={api_key}"
FIXTURE_DIR_NAME = "wekan"
diff --git a/zerver/webhooks/wordpress/tests.py b/zerver/webhooks/wordpress/tests.py
index ed2f35d9a87..b427d355428 100644
--- a/zerver/webhooks/wordpress/tests.py
+++ b/zerver/webhooks/wordpress/tests.py
@@ -4,7 +4,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}"
def test_publish_post(self) -> None:
@@ -59,7 +58,7 @@ class WordPressHookTests(WebhookTestCase):
# return if no params are sent. The fixture for this test is an empty file.
# subscribe to the target channel
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
# post to the webhook url
result = self.client_post(
@@ -75,7 +74,7 @@ class WordPressHookTests(WebhookTestCase):
# Similar to unknown_action_no_data, except the fixture contains valid blog post
# params but without the hook parameter. This should also return an error.
- self.subscribe(self.test_user, self.CHANNEL_NAME)
+ self.subscribe(self.test_user, self.channel_name)
result = self.client_post(
self.url,
self.get_body("unknown_action_no_hook_provided"),
diff --git a/zerver/webhooks/zabbix/tests.py b/zerver/webhooks/zabbix/tests.py
index 307ef6412a0..13ca0eed9e8 100644
--- a/zerver/webhooks/zabbix/tests.py
+++ b/zerver/webhooks/zabbix/tests.py
@@ -5,7 +5,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}"
def test_zabbix_alert_message(self) -> None:
diff --git a/zerver/webhooks/zapier/tests.py b/zerver/webhooks/zapier/tests.py
index f49d5a52dd6..c75cd134c8f 100644
--- a/zerver/webhooks/zapier/tests.py
+++ b/zerver/webhooks/zapier/tests.py
@@ -2,7 +2,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}"
def test_zapier_when_subject_and_body_are_correct(self) -> None:
@@ -24,7 +23,6 @@ class ZapierHookTests(WebhookTestCase):
class ZapierZulipAppTests(WebhookTestCase):
- CHANNEL_NAME = "zapier"
URL_TEMPLATE = "/api/v1/external/zapier?api_key={api_key}&stream={stream}"
def test_auth(self) -> None:
diff --git a/zerver/webhooks/zendesk/tests.py b/zerver/webhooks/zendesk/tests.py
index 22b95719b9d..f8fb49f8400 100644
--- a/zerver/webhooks/zendesk/tests.py
+++ b/zerver/webhooks/zendesk/tests.py
@@ -4,7 +4,6 @@ from zerver.lib.test_classes import WebhookTestCase
class ZenDeskHookTests(WebhookTestCase):
- CHANNEL_NAME = "zendesk"
URL_TEMPLATE = "/api/v1/external/zendesk?stream={stream}"
@override
@@ -13,7 +12,7 @@ class ZenDeskHookTests(WebhookTestCase):
"ticket_title": self.TICKET_TITLE,
"ticket_id": str(self.TICKET_ID),
"message": self.MESSAGE,
- "stream": self.CHANNEL_NAME,
+ "stream": self.channel_name,
}
def do_test(self, expected_topic: str, expected_message: str) -> None: