webhooks: Rename STREAM_NAME to CHANNEL_NAME in tests.

This commit is contained in:
Mateusz Mandera 2024-05-04 22:02:50 +02:00 committed by Tim Abbott
parent d507706371
commit dc31347ac4
93 changed files with 148 additions and 148 deletions

View File

@ -328,7 +328,7 @@ class `HelloWorldHookTests`:
```python ```python
class HelloWorldHookTests(WebhookTestCase): class HelloWorldHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}"
DIRECT_MESSAGE_URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}" DIRECT_MESSAGE_URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}"
WEBHOOK_DIR_NAME = "helloworld" WEBHOOK_DIR_NAME = "helloworld"
@ -347,14 +347,14 @@ class HelloWorldHookTests(WebhookTestCase):
) )
``` ```
In the above example, `STREAM_NAME`, `URL_TEMPLATE`, and `WEBHOOK_DIR_NAME` refer In the above example, `CHANNEL_NAME`, `URL_TEMPLATE`, and `WEBHOOK_DIR_NAME` refer
to class attributes from the base class, `WebhookTestCase`. These are needed by to class attributes from the base class, `WebhookTestCase`. These are needed by
the helper function `check_webhook` to determine how to execute the helper function `check_webhook` to determine how to execute
your test. `STREAM_NAME` should be set to your default stream. If it doesn't exist, your test. `CHANNEL_NAME` should be set to your default stream. If it doesn't exist,
`check_webhook` will create it while executing your test. `check_webhook` will create it while executing your test.
If your test expects a stream name from a test fixture, the value in the fixture If your test expects a stream name from a test fixture, the value in the fixture
and the value you set for `STREAM_NAME` must match. The test helpers use `STREAM_NAME` and the value you set for `CHANNEL_NAME` must match. The test helpers use `CHANNEL_NAME`
to create the destination stream, and then create the message to send using the to create the destination stream, and then create the message to send using the
value from the fixture. If these don't match, the test will fail. value from the fixture. If these don't match, the test will fail.
@ -532,10 +532,10 @@ def test_unknown_action_no_data(self) -> None:
# return if no params are sent. The fixture for this test is an empty file. # return if no params are sent. The fixture for this test is an empty file.
# subscribe to the target stream # subscribe to the target stream
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
# post to the webhook url # post to the webhook url
post_params = {'stream_name': self.STREAM_NAME, post_params = {'stream_name': self.CHANNEL_NAME,
'content_type': 'application/x-www-form-urlencoded'} 'content_type': 'application/x-www-form-urlencoded'}
result = self.client_post(self.url, 'unknown_action', **post_params) result = self.client_post(self.url, 'unknown_action', **post_params)
@ -549,7 +549,7 @@ the webhook returns an error, the test fails. Instead, explicitly do the
setup it would have done, and check the result yourself. setup it would have done, and check the result yourself.
Here, `subscribe_to_stream` is a test helper that uses `TEST_USER_EMAIL` and Here, `subscribe_to_stream` is a test helper that uses `TEST_USER_EMAIL` and
`STREAM_NAME` (attributes from the base class) to register the user to receive `CHANNEL_NAME` (attributes from the base class) to register the user to receive
messages in the given stream. If the stream doesn't exist, it creates it. messages in the given stream. If the stream doesn't exist, it creates it.
`client_post`, another helper, performs the HTTP POST that calls the incoming `client_post`, another helper, performs the HTTP POST that calls the incoming
@ -592,7 +592,7 @@ attribute `TOPIC` as a keyword argument to `build_webhook_url`, like so:
```python ```python
class QuerytestHookTests(WebhookTestCase): class QuerytestHookTests(WebhookTestCase):
STREAM_NAME = 'querytest' CHANNEL_NAME = 'querytest'
TOPIC = "Default topic" TOPIC = "Default topic"
URL_TEMPLATE = "/api/v1/external/querytest?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/querytest?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = 'querytest' FIXTURE_DIR_NAME = 'querytest'

View File

@ -2080,7 +2080,7 @@ class WebhookTestCase(ZulipTestCase):
important for ensuring we document all fully supported event types. important for ensuring we document all fully supported event types.
""" """
STREAM_NAME: Optional[str] = None CHANNEL_NAME: Optional[str] = None
TEST_USER_EMAIL = "webhook-bot@zulip.com" TEST_USER_EMAIL = "webhook-bot@zulip.com"
URL_TEMPLATE: str URL_TEMPLATE: str
WEBHOOK_DIR_NAME: Optional[str] = None WEBHOOK_DIR_NAME: Optional[str] = None
@ -2185,7 +2185,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 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: fixtures. Then we verify that a message gets sent to a stream:
self.STREAM_NAME: stream name self.CHANNEL_NAME: stream name
expected_topic_name: topic name expected_topic_name: topic name
expected_message: content expected_message: content
@ -2197,8 +2197,8 @@ 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. When no message is expected to be sent, set `expect_noop` to True.
""" """
assert self.STREAM_NAME is not None assert self.CHANNEL_NAME is not None
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
payload = self.get_payload(fixture_name) payload = self.get_payload(fixture_name)
if content_type is not None: if content_type is not None:
@ -2234,7 +2234,7 @@ one or more new messages.
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=expected_topic_name, topic_name=expected_topic_name,
content=expected_message, content=expected_message,
) )
@ -2291,9 +2291,9 @@ one or more new messages.
url = self.URL_TEMPLATE url = self.URL_TEMPLATE
if url.find("api_key") >= 0: if url.find("api_key") >= 0:
api_key = get_api_key(self.test_user) api_key = get_api_key(self.test_user)
url = self.URL_TEMPLATE.format(api_key=api_key, stream=self.STREAM_NAME) url = self.URL_TEMPLATE.format(api_key=api_key, stream=self.CHANNEL_NAME)
else: else:
url = self.URL_TEMPLATE.format(stream=self.STREAM_NAME) url = self.URL_TEMPLATE.format(stream=self.CHANNEL_NAME)
has_arguments = kwargs or args has_arguments = kwargs or args
if has_arguments and url.find("?") == -1: if has_arguments and url.find("?") == -1:

View File

@ -144,25 +144,25 @@ class WebhooksCommonTestCase(ZulipTestCase):
class WebhookURLConfigurationTestCase(WebhookTestCase): class WebhookURLConfigurationTestCase(WebhookTestCase):
STREAM_NAME = "helloworld" CHANNEL_NAME = "helloworld"
WEBHOOK_DIR_NAME = "helloworld" WEBHOOK_DIR_NAME = "helloworld"
URL_TEMPLATE = "/api/v1/external/helloworld?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/helloworld?stream={stream}&api_key={api_key}"
@override @override
def setUp(self) -> None: def setUp(self) -> None:
super().setUp() super().setUp()
stream = self.subscribe(self.test_user, self.STREAM_NAME) stream = self.subscribe(self.test_user, self.CHANNEL_NAME)
# In actual webhook tests, we will not need to use stream id. # In actual webhook tests, we will not need to use stream id.
# We assign stream id to STREAM_NAME for testing URL configuration only. # We assign stream id to CHANNEL_NAME for testing URL configuration only.
self.STREAM_NAME = str(stream.id) self.CHANNEL_NAME = str(stream.id)
do_rename_stream(stream, "helloworld_renamed", self.test_user) do_rename_stream(stream, "helloworld_renamed", self.test_user)
self.url = self.build_webhook_url() self.url = self.build_webhook_url()
def test_trigger_stream_message_by_id(self) -> None: def test_trigger_stream_message_by_id(self) -> None:
# check_webhook cannot be used here as it # check_webhook cannot be used here as it
# subscribes the test user to self.STREAM_NAME # subscribes the test user to self.CHANNEL_NAME
payload = self.get_body("hello") payload = self.get_body("hello")
self.send_webhook_payload( self.send_webhook_payload(
@ -182,13 +182,13 @@ class WebhookURLConfigurationTestCase(WebhookTestCase):
class MissingEventHeaderTestCase(WebhookTestCase): class MissingEventHeaderTestCase(WebhookTestCase):
STREAM_NAME = "groove" CHANNEL_NAME = "groove"
URL_TEMPLATE = "/api/v1/external/groove?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/groove?stream={stream}&api_key={api_key}"
# This tests the validate_extract_webhook_http_header function with # This tests the validate_extract_webhook_http_header function with
# an actual webhook, instead of just making a mock # an actual webhook, instead of just making a mock
def test_missing_event_header(self) -> None: def test_missing_event_header(self) -> None:
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
with self.assertLogs("zulip.zerver.webhooks.anomalous", level="INFO") as webhook_logs: with self.assertLogs("zulip.zerver.webhooks.anomalous", level="INFO") as webhook_logs:
result = self.client_post( result = self.client_post(
self.url, self.url,

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class AirbrakeHookTests(WebhookTestCase): class AirbrakeHookTests(WebhookTestCase):
STREAM_NAME = "airbrake" CHANNEL_NAME = "airbrake"
URL_TEMPLATE = "/api/v1/external/airbrake?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/airbrake?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "airbrake" WEBHOOK_DIR_NAME = "airbrake"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class AlertmanagerHookTests(WebhookTestCase): class AlertmanagerHookTests(WebhookTestCase):
STREAM_NAME = "alertmanager" CHANNEL_NAME = "alertmanager"
URL_TEMPLATE = "/api/v1/external/alertmanager?&api_key={api_key}&stream={stream}&name=topic&desc=description" URL_TEMPLATE = "/api/v1/external/alertmanager?&api_key={api_key}&stream={stream}&name=topic&desc=description"
WEBHOOK_DIR_NAME = "alertmanager" WEBHOOK_DIR_NAME = "alertmanager"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class AnsibletowerHookTests(WebhookTestCase): class AnsibletowerHookTests(WebhookTestCase):
STREAM_NAME = "ansibletower" CHANNEL_NAME = "ansibletower"
URL_TEMPLATE = "/api/v1/external/ansibletower?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/ansibletower?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "ansibletower" WEBHOOK_DIR_NAME = "ansibletower"

View File

@ -3,7 +3,7 @@ from zerver.webhooks.appfollow.view import convert_markdown
class AppFollowHookTests(WebhookTestCase): class AppFollowHookTests(WebhookTestCase):
STREAM_NAME = "appfollow" CHANNEL_NAME = "appfollow"
URL_TEMPLATE = "/api/v1/external/appfollow?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/appfollow?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "appfollow" WEBHOOK_DIR_NAME = "appfollow"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class AppveyorHookTests(WebhookTestCase): class AppveyorHookTests(WebhookTestCase):
STREAM_NAME = "appveyor" CHANNEL_NAME = "appveyor"
URL_TEMPLATE = "/api/v1/external/appveyor?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/appveyor?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "appveyor" WEBHOOK_DIR_NAME = "appveyor"

View File

@ -5,7 +5,7 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class AzuredevopsHookTests(WebhookTestCase): class AzuredevopsHookTests(WebhookTestCase):
STREAM_NAME = "azure-devops" CHANNEL_NAME = "azure-devops"
URL_TEMPLATE = "/api/v1/external/azuredevops?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/azuredevops?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "azuredevops" WEBHOOK_DIR_NAME = "azuredevops"

View File

@ -4,7 +4,7 @@ TOPIC_NAME = "Zulip HQ"
class BasecampHookTests(WebhookTestCase): class BasecampHookTests(WebhookTestCase):
STREAM_NAME = "basecamp" CHANNEL_NAME = "basecamp"
URL_TEMPLATE = "/api/v1/external/basecamp?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/basecamp?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "basecamp" WEBHOOK_DIR_NAME = "basecamp"

View File

@ -8,7 +8,7 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class BeanstalkHookTests(WebhookTestCase): class BeanstalkHookTests(WebhookTestCase):
STREAM_NAME = "commits" CHANNEL_NAME = "commits"
URL_TEMPLATE = "/api/v1/external/beanstalk?stream={stream}" URL_TEMPLATE = "/api/v1/external/beanstalk?stream={stream}"
def test_git_single(self) -> None: def test_git_single(self) -> None:

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class BeeminderHookTests(WebhookTestCase): class BeeminderHookTests(WebhookTestCase):
STREAM_NAME = "beeminder" CHANNEL_NAME = "beeminder"
URL_TEMPLATE = "/api/v1/external/beeminder?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/beeminder?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "beeminder" WEBHOOK_DIR_NAME = "beeminder"

View File

@ -7,7 +7,7 @@ TOPIC_BRANCH_EVENTS = "Repository name / master"
class BitbucketHookTests(WebhookTestCase): class BitbucketHookTests(WebhookTestCase):
STREAM_NAME = "bitbucket" CHANNEL_NAME = "bitbucket"
URL_TEMPLATE = "/api/v1/external/bitbucket?stream={stream}" URL_TEMPLATE = "/api/v1/external/bitbucket?stream={stream}"
WEBHOOK_DIR_NAME = "bitbucket" WEBHOOK_DIR_NAME = "bitbucket"

View File

@ -14,7 +14,7 @@ TOPIC_BRANCH_EVENTS = "Repository name / master"
class Bitbucket2HookTests(WebhookTestCase): class Bitbucket2HookTests(WebhookTestCase):
STREAM_NAME = "bitbucket2" CHANNEL_NAME = "bitbucket2"
URL_TEMPLATE = "/api/v1/external/bitbucket2?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/bitbucket2?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "bitbucket2" WEBHOOK_DIR_NAME = "bitbucket2"
@ -278,7 +278,7 @@ class Bitbucket2HookTests(WebhookTestCase):
def test_bitbucket2_on_push_more_than_one_tag_event(self) -> None: 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})." expected_message = "Tomasz pushed tag [{name}](https://bitbucket.org/kolaszek/repository-name/commits/tag/{name})."
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
payload = self.get_body("push_more_than_one_tag") payload = self.get_body("push_more_than_one_tag")
msg = self.send_webhook_payload( msg = self.send_webhook_payload(
@ -292,7 +292,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_second_to_last_message() msg = self.get_second_to_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=TOPIC, topic_name=TOPIC,
content=expected_message.format(name="a"), content=expected_message.format(name="a"),
) )
@ -300,13 +300,13 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_last_message() msg = self.get_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=TOPIC, topic_name=TOPIC,
content=expected_message.format(name="b"), content=expected_message.format(name="b"),
) )
def test_bitbucket2_on_more_than_one_push_event(self) -> None: def test_bitbucket2_on_more_than_one_push_event(self) -> None:
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
payload = self.get_body("more_than_one_push_event") payload = self.get_body("more_than_one_push_event")
msg = self.send_webhook_payload( msg = self.send_webhook_payload(
@ -320,7 +320,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_second_to_last_message() msg = self.get_second_to_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=TOPIC_BRANCH_EVENTS, 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))", 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))",
) )
@ -328,7 +328,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_last_message() msg = self.get_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=TOPIC, topic_name=TOPIC,
content="Tomasz pushed tag [a](https://bitbucket.org/kolaszek/repository-name/commits/tag/a).", content="Tomasz pushed tag [a](https://bitbucket.org/kolaszek/repository-name/commits/tag/a).",
) )
@ -336,7 +336,7 @@ class Bitbucket2HookTests(WebhookTestCase):
def test_bitbucket2_on_more_than_one_push_event_filtered_by_branches(self) -> None: def test_bitbucket2_on_more_than_one_push_event_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url(branches="master,development") self.url = self.build_webhook_url(branches="master,development")
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
payload = self.get_body("more_than_one_push_event") payload = self.get_body("more_than_one_push_event")
msg = self.send_webhook_payload( msg = self.send_webhook_payload(
@ -350,7 +350,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_second_to_last_message() msg = self.get_second_to_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=TOPIC_BRANCH_EVENTS, 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))", 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))",
) )
@ -358,7 +358,7 @@ class Bitbucket2HookTests(WebhookTestCase):
msg = self.get_last_message() msg = self.get_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=TOPIC, topic_name=TOPIC,
content="Tomasz pushed tag [a](https://bitbucket.org/kolaszek/repository-name/commits/tag/a).", content="Tomasz pushed tag [a](https://bitbucket.org/kolaszek/repository-name/commits/tag/a).",
) )

View File

@ -5,7 +5,7 @@ TOPIC_BRANCH_EVENTS = "sandbox / {branch}"
class Bitbucket3HookTests(WebhookTestCase): class Bitbucket3HookTests(WebhookTestCase):
STREAM_NAME = "bitbucket3" CHANNEL_NAME = "bitbucket3"
URL_TEMPLATE = "/api/v1/external/bitbucket3?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/bitbucket3?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "bitbucket3" WEBHOOK_DIR_NAME = "bitbucket3"
@ -81,7 +81,7 @@ class Bitbucket3HookTests(WebhookTestCase):
branch1_content = """[hypro999](http://139.59.64.214:7990/users/hypro999) pushed to branch branch1. Head is now 3980c2be32a7e23c795741d5dc1a2eecb9b85d6d.""" 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.""" 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.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
payload = self.get_body("repo_push_update_multiple_branches") payload = self.get_body("repo_push_update_multiple_branches")
msg = self.send_webhook_payload( msg = self.send_webhook_payload(
@ -94,7 +94,7 @@ class Bitbucket3HookTests(WebhookTestCase):
msg = self.get_second_to_last_message() msg = self.get_second_to_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=TOPIC_BRANCH_EVENTS.format(branch="branch1"), topic_name=TOPIC_BRANCH_EVENTS.format(branch="branch1"),
content=branch1_content, content=branch1_content,
) )
@ -102,7 +102,7 @@ class Bitbucket3HookTests(WebhookTestCase):
msg = self.get_last_message() msg = self.get_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=TOPIC_BRANCH_EVENTS.format(branch="master"), topic_name=TOPIC_BRANCH_EVENTS.format(branch="master"),
content=master_content, content=master_content,
) )

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class BuildbotHookTests(WebhookTestCase): class BuildbotHookTests(WebhookTestCase):
STREAM_NAME = "buildbot" CHANNEL_NAME = "buildbot"
URL_TEMPLATE = "/api/v1/external/buildbot?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/buildbot?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "buildbot" WEBHOOK_DIR_NAME = "buildbot"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class CanarytokensHookTests(WebhookTestCase): class CanarytokensHookTests(WebhookTestCase):
STREAM_NAME = "canarytoken" CHANNEL_NAME = "canarytoken"
URL_TEMPLATE = "/api/v1/external/canarytoken?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/canarytoken?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "canarytoken" WEBHOOK_DIR_NAME = "canarytoken"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class CircleCiHookTests(WebhookTestCase): class CircleCiHookTests(WebhookTestCase):
STREAM_NAME = "circleci" CHANNEL_NAME = "circleci"
URL_TEMPLATE = "/api/v1/external/circleci?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/circleci?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "circleci" WEBHOOK_DIR_NAME = "circleci"

View File

@ -5,7 +5,7 @@ from zerver.lib.test_classes import WebhookTestCase
class ClubhouseWebhookTest(WebhookTestCase): class ClubhouseWebhookTest(WebhookTestCase):
STREAM_NAME = "clubhouse" CHANNEL_NAME = "clubhouse"
URL_TEMPLATE = "/api/v1/external/clubhouse?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/clubhouse?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "clubhouse" WEBHOOK_DIR_NAME = "clubhouse"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class CodeshipHookTests(WebhookTestCase): class CodeshipHookTests(WebhookTestCase):
STREAM_NAME = "codeship" CHANNEL_NAME = "codeship"
URL_TEMPLATE = "/api/v1/external/codeship?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/codeship?stream={stream}&api_key={api_key}"
TOPIC_NAME = "codeship/docs" TOPIC_NAME = "codeship/docs"
WEBHOOK_DIR_NAME = "codeship" WEBHOOK_DIR_NAME = "codeship"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class CrashlyticsHookTests(WebhookTestCase): class CrashlyticsHookTests(WebhookTestCase):
STREAM_NAME = "crashlytics" CHANNEL_NAME = "crashlytics"
URL_TEMPLATE = "/api/v1/external/crashlytics?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/crashlytics?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "crashlytics" WEBHOOK_DIR_NAME = "crashlytics"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class DelightedHookTests(WebhookTestCase): class DelightedHookTests(WebhookTestCase):
STREAM_NAME = "delighted" CHANNEL_NAME = "delighted"
URL_TEMPLATE = "/api/v1/external/delighted?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/delighted?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "delighted" WEBHOOK_DIR_NAME = "delighted"

View File

@ -5,7 +5,7 @@ from zerver.lib.test_classes import WebhookTestCase
# Tests for the Desk.com webhook integration. # Tests for the Desk.com webhook integration.
# #
# The stream name must be provided in the URL-encoded test fixture data, # The stream name must be provided in the URL-encoded test fixture data,
# and must match STREAM_NAME set here. # and must match CHANNEL_NAME set here.
# #
# Example: # Example:
# #
@ -14,7 +14,7 @@ from zerver.lib.test_classes import WebhookTestCase
class DeskDotComHookTests(WebhookTestCase): class DeskDotComHookTests(WebhookTestCase):
STREAM_NAME = "deskdotcom" CHANNEL_NAME = "deskdotcom"
URL_TEMPLATE = "/api/v1/external/deskdotcom?stream={stream}" URL_TEMPLATE = "/api/v1/external/deskdotcom?stream={stream}"
WEBHOOK_DIR_NAME = "deskdotcom" WEBHOOK_DIR_NAME = "deskdotcom"

View File

@ -3,7 +3,7 @@ from zerver.lib.users import get_api_key
class DropboxHookTests(WebhookTestCase): class DropboxHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/dropbox?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/dropbox?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "dropbox" WEBHOOK_DIR_NAME = "dropbox"
@ -19,8 +19,8 @@ class DropboxHookTests(WebhookTestCase):
) )
def test_verification_request(self) -> None: def test_verification_request(self) -> None:
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
get_params = {"stream_name": self.STREAM_NAME, "api_key": get_api_key(self.test_user)} get_params = {"stream_name": self.CHANNEL_NAME, "api_key": get_api_key(self.test_user)}
result = self.client_get(self.url, get_params) result = self.client_get(self.url, get_params)
self.assert_json_error(result, "Missing 'challenge' argument", 400) self.assert_json_error(result, "Missing 'challenge' argument", 400)

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class ErrBitHookTests(WebhookTestCase): class ErrBitHookTests(WebhookTestCase):
STREAM_NAME = "errbit" CHANNEL_NAME = "errbit"
URL_TEMPLATE = "/api/v1/external/errbit?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/errbit?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "errbit" WEBHOOK_DIR_NAME = "errbit"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class FlockHookTests(WebhookTestCase): class FlockHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/flock?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/flock?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "flock" WEBHOOK_DIR_NAME = "flock"

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class FreshdeskHookTests(WebhookTestCase): class FreshdeskHookTests(WebhookTestCase):
STREAM_NAME = "freshdesk" CHANNEL_NAME = "freshdesk"
URL_TEMPLATE = "/api/v1/external/freshdesk?stream={stream}" URL_TEMPLATE = "/api/v1/external/freshdesk?stream={stream}"
WEBHOOK_DIR_NAME = "freshdesk" WEBHOOK_DIR_NAME = "freshdesk"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class FreshpingHookTests(WebhookTestCase): class FreshpingHookTests(WebhookTestCase):
STREAM_NAME = "freshping" CHANNEL_NAME = "freshping"
URL_TEMPLATE = "/api/v1/external/freshping?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/freshping?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "freshping" WEBHOOK_DIR_NAME = "freshping"

View File

@ -5,7 +5,7 @@ from zerver.webhooks.freshstatus.view import MISCONFIGURED_PAYLOAD_ERROR_MESSAGE
class FreshstatusHookTests(WebhookTestCase): class FreshstatusHookTests(WebhookTestCase):
STREAM_NAME = "freshstatus" CHANNEL_NAME = "freshstatus"
URL_TEMPLATE = "/api/v1/external/freshstatus?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/freshstatus?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "freshstatus" WEBHOOK_DIR_NAME = "freshstatus"

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class FrontHookTests(WebhookTestCase): class FrontHookTests(WebhookTestCase):
STREAM_NAME = "front" CHANNEL_NAME = "front"
URL_TEMPLATE = "/api/v1/external/front?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/front?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "front" WEBHOOK_DIR_NAME = "front"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class GoogleCodeInTests(WebhookTestCase): class GoogleCodeInTests(WebhookTestCase):
STREAM_NAME = "gci" CHANNEL_NAME = "gci"
URL_TEMPLATE = "/api/v1/external/gci?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/gci?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "gci" WEBHOOK_DIR_NAME = "gci"

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class GiteaHookTests(WebhookTestCase): class GiteaHookTests(WebhookTestCase):
STREAM_NAME = "commits" CHANNEL_NAME = "commits"
URL_TEMPLATE = "/api/v1/external/gitea?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/gitea?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "gitea" WEBHOOK_DIR_NAME = "gitea"

View File

@ -17,7 +17,7 @@ TOPIC_SPONSORS = "sponsors"
class GitHubWebhookTest(WebhookTestCase): class GitHubWebhookTest(WebhookTestCase):
STREAM_NAME = "github" CHANNEL_NAME = "github"
URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "github" WEBHOOK_DIR_NAME = "github"
@ -535,7 +535,7 @@ A temporary team so that I can get some webhook fixtures!
self.verify_post_is_ignored(payload, event) self.verify_post_is_ignored(payload, event)
def test_team_edited_with_unsupported_keys(self) -> None: def test_team_edited_with_unsupported_keys(self) -> None:
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
event = "team" event = "team"
payload = dict( payload = dict(
@ -560,7 +560,7 @@ A temporary team so that I can get some webhook fixtures!
self.assert_stream_message( self.assert_stream_message(
message=stream_message, message=stream_message,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name="team My Team", topic_name="team My Team",
content="Team has changes to `bogus_key1/bogus_key2` data.", content="Team has changes to `bogus_key1/bogus_key2` data.",
) )
@ -595,7 +595,7 @@ A temporary team so that I can get some webhook fixtures!
class GitHubSponsorsHookTests(WebhookTestCase): class GitHubSponsorsHookTests(WebhookTestCase):
STREAM_NAME = "github" CHANNEL_NAME = "github"
URL_TEMPLATE = "/api/v1/external/githubsponsors?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/githubsponsors?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "github" WEBHOOK_DIR_NAME = "github"

View File

@ -5,7 +5,7 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class GitlabHookTests(WebhookTestCase): class GitlabHookTests(WebhookTestCase):
STREAM_NAME = "gitlab" CHANNEL_NAME = "gitlab"
URL_TEMPLATE = "/api/v1/external/gitlab?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/gitlab?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "gitlab" WEBHOOK_DIR_NAME = "gitlab"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class GocdHookTests(WebhookTestCase): class GocdHookTests(WebhookTestCase):
STREAM_NAME = "gocd" CHANNEL_NAME = "gocd"
URL_TEMPLATE = "/api/v1/external/gocd?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/gocd?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "gocd" WEBHOOK_DIR_NAME = "gocd"
TOPIC_NAME = "https://github.com/gocd/gocd" TOPIC_NAME = "https://github.com/gocd/gocd"

View File

@ -5,7 +5,7 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class GogsHookTests(WebhookTestCase): class GogsHookTests(WebhookTestCase):
STREAM_NAME = "commits" CHANNEL_NAME = "commits"
URL_TEMPLATE = "/api/v1/external/gogs?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/gogs?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "gogs" WEBHOOK_DIR_NAME = "gogs"

View File

@ -3,7 +3,7 @@ from zerver.webhooks.gosquared.view import CHAT_MESSAGE_TEMPLATE
class GoSquaredHookTests(WebhookTestCase): class GoSquaredHookTests(WebhookTestCase):
STREAM_NAME = "gosquared" CHANNEL_NAME = "gosquared"
URL_TEMPLATE = "/api/v1/external/gosquared?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/gosquared?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "gosquared" WEBHOOK_DIR_NAME = "gosquared"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class GrafanaHookTests(WebhookTestCase): class GrafanaHookTests(WebhookTestCase):
STREAM_NAME = "grafana" CHANNEL_NAME = "grafana"
URL_TEMPLATE = "/api/v1/external/grafana?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/grafana?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "grafana" WEBHOOK_DIR_NAME = "grafana"

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class GreenhouseHookTests(WebhookTestCase): class GreenhouseHookTests(WebhookTestCase):
STREAM_NAME = "greenhouse" CHANNEL_NAME = "greenhouse"
URL_TEMPLATE = "/api/v1/external/greenhouse?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/greenhouse?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "greenhouse" WEBHOOK_DIR_NAME = "greenhouse"
CONTENT_TYPE = "application/x-www-form-urlencoded" CONTENT_TYPE = "application/x-www-form-urlencoded"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class GrooveHookTests(WebhookTestCase): class GrooveHookTests(WebhookTestCase):
STREAM_NAME = "groove" CHANNEL_NAME = "groove"
URL_TEMPLATE = "/api/v1/external/groove?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/groove?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "groove" WEBHOOK_DIR_NAME = "groove"
@ -64,7 +64,7 @@ The content of the body goes here.
# This simulates the condition when a ticket # This simulates the condition when a ticket
# is assigned to no one. # is assigned to no one.
def test_groove_ticket_assigned_no_one(self) -> None: def test_groove_ticket_assigned_no_one(self) -> None:
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
result = self.client_post( result = self.client_post(
self.url, self.url,
self.get_body("ticket_assigned__no_one"), self.get_body("ticket_assigned__no_one"),

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class HarborHookTests(WebhookTestCase): class HarborHookTests(WebhookTestCase):
STREAM_NAME = "harbor" CHANNEL_NAME = "harbor"
URL_TEMPLATE = "/api/v1/external/harbor?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/harbor?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "harbor" WEBHOOK_DIR_NAME = "harbor"

View File

@ -6,7 +6,7 @@ from zerver.lib.test_classes import WebhookTestCase
class HelloSignHookTests(WebhookTestCase): class HelloSignHookTests(WebhookTestCase):
STREAM_NAME = "hellosign" CHANNEL_NAME = "hellosign"
URL_TEMPLATE = "/api/v1/external/hellosign?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/hellosign?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "hellosign" WEBHOOK_DIR_NAME = "hellosign"

View File

@ -6,7 +6,7 @@ from zerver.models.users import get_system_bot
class HelloWorldHookTests(WebhookTestCase): class HelloWorldHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}"
DIRECT_MESSAGE_URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}" DIRECT_MESSAGE_URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}"
WEBHOOK_DIR_NAME = "helloworld" WEBHOOK_DIR_NAME = "helloworld"
@ -50,7 +50,7 @@ class HelloWorldHookTests(WebhookTestCase):
def test_stream_error_pm_to_bot_owner(self) -> None: def test_stream_error_pm_to_bot_owner(self) -> None:
# Note that this is really just a test for check_send_webhook_message # Note that this is really just a test for check_send_webhook_message
self.STREAM_NAME = "nonexistent" self.CHANNEL_NAME = "nonexistent"
self.url = self.build_webhook_url() self.url = self.build_webhook_url()
realm = get_realm("zulip") realm = get_realm("zulip")
notification_bot = get_system_bot(settings.NOTIFICATION_BOT, realm.id) notification_bot = get_system_bot(settings.NOTIFICATION_BOT, realm.id)

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class HerokuHookTests(WebhookTestCase): class HerokuHookTests(WebhookTestCase):
STREAM_NAME = "heroku" CHANNEL_NAME = "heroku"
URL_TEMPLATE = "/api/v1/external/heroku?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/heroku?stream={stream}&api_key={api_key}"
def test_deployment(self) -> None: def test_deployment(self) -> None:

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class HomeAssistantHookTests(WebhookTestCase): class HomeAssistantHookTests(WebhookTestCase):
STREAM_NAME = "homeassistant" CHANNEL_NAME = "homeassistant"
URL_TEMPLATE = "/api/v1/external/homeassistant?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/homeassistant?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "homeassistant" WEBHOOK_DIR_NAME = "homeassistant"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class IFTTTHookTests(WebhookTestCase): class IFTTTHookTests(WebhookTestCase):
STREAM_NAME = "ifttt" CHANNEL_NAME = "ifttt"
URL_TEMPLATE = "/api/v1/external/ifttt?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/ifttt?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "ifttt" WEBHOOK_DIR_NAME = "ifttt"
VIEW_FUNCTION_NAME = "api_iftt_app_webhook" VIEW_FUNCTION_NAME = "api_iftt_app_webhook"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class InspingHookTests(WebhookTestCase): class InspingHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/insping?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/insping?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "insping" WEBHOOK_DIR_NAME = "insping"

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class IntercomWebHookTests(WebhookTestCase): class IntercomWebHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/intercom?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/intercom?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "intercom" WEBHOOK_DIR_NAME = "intercom"

View File

@ -6,7 +6,7 @@ from zerver.lib.users import get_api_key
class JiraHookTests(WebhookTestCase): class JiraHookTests(WebhookTestCase):
STREAM_NAME = "jira" CHANNEL_NAME = "jira"
URL_TEMPLATE = "/api/v1/external/jira?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/jira?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "jira" WEBHOOK_DIR_NAME = "jira"
@ -65,9 +65,9 @@ Leo Franchi created [BUG-15: New bug with hook](http://lfranchi.com:8080/browse/
self.assert_json_success(result) self.assert_json_success(result)
def test_created_with_stream_with_spaces_escaped(self) -> None: def test_created_with_stream_with_spaces_escaped(self) -> None:
self.STREAM_NAME = quote("jira alerts") self.CHANNEL_NAME = quote("jira alerts")
self.url = self.build_webhook_url() self.url = self.build_webhook_url()
self.subscribe(self.test_user, unquote(self.STREAM_NAME)) self.subscribe(self.test_user, unquote(self.CHANNEL_NAME))
payload = self.get_body("created_v1") payload = self.get_body("created_v1")
result = self.client_post(self.url, payload, content_type="application/json") result = self.client_post(self.url, payload, content_type="application/json")
@ -86,9 +86,9 @@ Leo Franchi created [BUG-15: New bug with hook](http://lfranchi.com:8080/browse/
self.assertEqual(msg.topic_name(), expected_topic_name) self.assertEqual(msg.topic_name(), expected_topic_name)
def test_created_with_stream_with_spaces_double_escaped(self) -> None: def test_created_with_stream_with_spaces_double_escaped(self) -> None:
self.STREAM_NAME = quote(quote("jira alerts")) self.CHANNEL_NAME = quote(quote("jira alerts"))
self.url = self.build_webhook_url() self.url = self.build_webhook_url()
self.subscribe(self.test_user, unquote(unquote(self.STREAM_NAME))) self.subscribe(self.test_user, unquote(unquote(self.CHANNEL_NAME)))
payload = self.get_body("created_v1") payload = self.get_body("created_v1")
result = self.client_post(self.url, payload, content_type="application/json") result = self.client_post(self.url, payload, content_type="application/json")

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class JotformHookTests(WebhookTestCase): class JotformHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/jotform?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/jotform?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "jotform" WEBHOOK_DIR_NAME = "jotform"

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class JsonHookTests(WebhookTestCase): class JsonHookTests(WebhookTestCase):
STREAM_NAME = "json" CHANNEL_NAME = "json"
URL_TEMPLATE = "/api/v1/external/json?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/json?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "json" WEBHOOK_DIR_NAME = "json"

View File

@ -6,7 +6,7 @@ from zerver.lib.test_classes import WebhookTestCase
class LibratoHookTests(WebhookTestCase): class LibratoHookTests(WebhookTestCase):
STREAM_NAME = "librato" CHANNEL_NAME = "librato"
URL_TEMPLATE = "/api/v1/external/librato?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/librato?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "librato" WEBHOOK_DIR_NAME = "librato"
IS_ATTACHMENT = False IS_ATTACHMENT = False

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class LidarrHookTests(WebhookTestCase): class LidarrHookTests(WebhookTestCase):
STREAM_NAME = "lidarr" CHANNEL_NAME = "lidarr"
URL_TEMPLATE = "/api/v1/external/lidarr?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/lidarr?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "lidarr" WEBHOOK_DIR_NAME = "lidarr"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class LinearHookTests(WebhookTestCase): class LinearHookTests(WebhookTestCase):
STREAM_NAME = "Linear" CHANNEL_NAME = "Linear"
URL_TEMPLATE = "/api/v1/external/linear?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/linear?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "linear" WEBHOOK_DIR_NAME = "linear"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class MentionHookTests(WebhookTestCase): class MentionHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/mention?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/mention?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "mention" WEBHOOK_DIR_NAME = "mention"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class NetlifyHookTests(WebhookTestCase): class NetlifyHookTests(WebhookTestCase):
STREAM_NAME = "netlify" CHANNEL_NAME = "netlify"
URL_TEMPLATE = "/api/v1/external/netlify?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/netlify?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "netlify" WEBHOOK_DIR_NAME = "netlify"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class NewRelicHookTests(WebhookTestCase): class NewRelicHookTests(WebhookTestCase):
STREAM_NAME = "newrelic" CHANNEL_NAME = "newrelic"
URL_TEMPLATE = "/api/v1/external/newrelic?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/newrelic?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "newrelic" WEBHOOK_DIR_NAME = "newrelic"

View File

@ -4,7 +4,7 @@ from zerver.webhooks.opbeat.view import get_value
class OpbeatHookTests(WebhookTestCase): class OpbeatHookTests(WebhookTestCase):
STREAM_NAME = "opbeat" CHANNEL_NAME = "opbeat"
URL_TEMPLATE = "/api/v1/external/opbeat?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/opbeat?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "opbeat" WEBHOOK_DIR_NAME = "opbeat"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class OpenCollectiveHookTests(WebhookTestCase): class OpenCollectiveHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/opencollective?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/opencollective?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "opencollective" WEBHOOK_DIR_NAME = "opencollective"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class OpsgenieHookTests(WebhookTestCase): class OpsgenieHookTests(WebhookTestCase):
STREAM_NAME = "opsgenie" CHANNEL_NAME = "opsgenie"
URL_TEMPLATE = "/api/v1/external/opsgenie?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/opsgenie?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "opsgenie" WEBHOOK_DIR_NAME = "opsgenie"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class PagerDutyHookTests(WebhookTestCase): class PagerDutyHookTests(WebhookTestCase):
STREAM_NAME = "pagerduty" CHANNEL_NAME = "pagerduty"
URL_TEMPLATE = "/api/v1/external/pagerduty?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/pagerduty?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "pagerduty" WEBHOOK_DIR_NAME = "pagerduty"

View File

@ -6,7 +6,7 @@ from zerver.lib.test_classes import WebhookTestCase
class PapertrailHookTests(WebhookTestCase): class PapertrailHookTests(WebhookTestCase):
STREAM_NAME = "papertrail" CHANNEL_NAME = "papertrail"
URL_TEMPLATE = "/api/v1/external/papertrail?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/papertrail?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "papertrail" WEBHOOK_DIR_NAME = "papertrail"

View File

@ -13,7 +13,7 @@ IGNORED_EVENTS = [
class PatreonHookTests(WebhookTestCase): class PatreonHookTests(WebhookTestCase):
STREAM_NAME = "Patreon" CHANNEL_NAME = "Patreon"
URL_TEMPLATE = "/api/v1/external/patreon?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/patreon?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "patreon" WEBHOOK_DIR_NAME = "patreon"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class PingdomHookTests(WebhookTestCase): class PingdomHookTests(WebhookTestCase):
STREAM_NAME = "pingdom" CHANNEL_NAME = "pingdom"
URL_TEMPLATE = "/api/v1/external/pingdom?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/pingdom?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "pingdom" WEBHOOK_DIR_NAME = "pingdom"

View File

@ -9,7 +9,7 @@ from zerver.webhooks.pivotal.view import api_pivotal_webhook_v5
class PivotalV3HookTests(WebhookTestCase): class PivotalV3HookTests(WebhookTestCase):
STREAM_NAME = "pivotal" CHANNEL_NAME = "pivotal"
URL_TEMPLATE = "/api/v1/external/pivotal?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/pivotal?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "pivotal" WEBHOOK_DIR_NAME = "pivotal"
@ -112,7 +112,7 @@ class PivotalV3HookTests(WebhookTestCase):
class PivotalV5HookTests(WebhookTestCase): class PivotalV5HookTests(WebhookTestCase):
STREAM_NAME = "pivotal" CHANNEL_NAME = "pivotal"
URL_TEMPLATE = "/api/v1/external/pivotal?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/pivotal?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "pivotal" WEBHOOK_DIR_NAME = "pivotal"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class RadarrHookTests(WebhookTestCase): class RadarrHookTests(WebhookTestCase):
STREAM_NAME = "radarr" CHANNEL_NAME = "radarr"
URL_TEMPLATE = "/api/v1/external/radarr?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/radarr?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "radarr" WEBHOOK_DIR_NAME = "radarr"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class RaygunHookTests(WebhookTestCase): class RaygunHookTests(WebhookTestCase):
STREAM_NAME = "raygun" CHANNEL_NAME = "raygun"
URL_TEMPLATE = "/api/v1/external/raygun?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/raygun?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "raygun" WEBHOOK_DIR_NAME = "raygun"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class ReviewBoardHookTests(WebhookTestCase): class ReviewBoardHookTests(WebhookTestCase):
STREAM_NAME = "reviewboard" CHANNEL_NAME = "reviewboard"
URL_TEMPLATE = "/api/v1/external/reviewboard?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/reviewboard?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "reviewboard" WEBHOOK_DIR_NAME = "reviewboard"

View File

@ -5,7 +5,7 @@ from zerver.lib.webhooks.git import COMMITS_LIMIT
class RhodecodeHookTests(WebhookTestCase): class RhodecodeHookTests(WebhookTestCase):
STREAM_NAME = "rhodecode" CHANNEL_NAME = "rhodecode"
URL_TEMPLATE = "/api/v1/external/rhodecode?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/rhodecode?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "rhodecode" WEBHOOK_DIR_NAME = "rhodecode"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class RundeckHookTests(WebhookTestCase): class RundeckHookTests(WebhookTestCase):
STREAM_NAME = "Rundeck" CHANNEL_NAME = "Rundeck"
TOPIC_NAME = "Global Log Filter Usage" TOPIC_NAME = "Global Log Filter Usage"
URL_TEMPLATE = "/api/v1/external/rundeck?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/rundeck?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "rundeck" WEBHOOK_DIR_NAME = "rundeck"

View File

@ -6,7 +6,7 @@ from zerver.lib.test_classes import WebhookTestCase
class SemaphoreHookTests(WebhookTestCase): class SemaphoreHookTests(WebhookTestCase):
STREAM_NAME = "semaphore" CHANNEL_NAME = "semaphore"
URL_TEMPLATE = "/api/v1/external/semaphore?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/semaphore?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "semaphore" WEBHOOK_DIR_NAME = "semaphore"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class SentryHookTests(WebhookTestCase): class SentryHookTests(WebhookTestCase):
STREAM_NAME = "sentry" CHANNEL_NAME = "sentry"
URL_TEMPLATE = "/api/v1/external/sentry?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/sentry?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "sentry" WEBHOOK_DIR_NAME = "sentry"

View File

@ -7,7 +7,7 @@ EXPECTED_MESSAGE = "**slack_user**: test"
class SlackWebhookTests(WebhookTestCase): class SlackWebhookTests(WebhookTestCase):
STREAM_NAME = "slack" CHANNEL_NAME = "slack"
URL_TEMPLATE = "/api/v1/external/slack?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/slack?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "slack" WEBHOOK_DIR_NAME = "slack"
@ -50,7 +50,7 @@ class SlackWebhookTests(WebhookTestCase):
) )
def test_slack_channels_map_to_topics_false(self) -> None: def test_slack_channels_map_to_topics_false(self) -> None:
self.STREAM_NAME = "general" self.CHANNEL_NAME = "general"
self.url = self.build_webhook_url(channels_map_to_topics="0") self.url = self.build_webhook_url(channels_map_to_topics="0")
self.check_webhook( self.check_webhook(
"message_info", "message_info",
@ -60,7 +60,7 @@ class SlackWebhookTests(WebhookTestCase):
) )
def test_slack_channels_map_to_topics_false_and_user_specified_topic(self) -> None: def test_slack_channels_map_to_topics_false_and_user_specified_topic(self) -> None:
self.STREAM_NAME = "general" self.CHANNEL_NAME = "general"
self.url = self.build_webhook_url(topic="test", channels_map_to_topics="0") self.url = self.build_webhook_url(topic="test", channels_map_to_topics="0")
expected_topic_name = "test" expected_topic_name = "test"
self.check_webhook( self.check_webhook(

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class SlackIncomingHookTests(WebhookTestCase): class SlackIncomingHookTests(WebhookTestCase):
STREAM_NAME = "slack_incoming" CHANNEL_NAME = "slack_incoming"
URL_TEMPLATE = "/api/v1/external/slack_incoming?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/slack_incoming?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "slack_incoming" WEBHOOK_DIR_NAME = "slack_incoming"
@ -28,7 +28,7 @@ Hello, world.
("*foo*a*bar*", "*foo*a*bar*"), ("*foo*a*bar*", "*foo*a*bar*"),
("some _foo_ word", "some *foo* word"), ("some _foo_ word", "some *foo* word"),
] ]
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
for input_value, output_value in tests: for input_value, output_value in tests:
payload = {"text": input_value} payload = {"text": input_value}
msg = self.send_webhook_payload( msg = self.send_webhook_payload(
@ -39,7 +39,7 @@ Hello, world.
) )
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name="(no topic)", topic_name="(no topic)",
content=output_value, content=output_value,
) )

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class SolanoHookTests(WebhookTestCase): class SolanoHookTests(WebhookTestCase):
STREAM_NAME = "solano labs" CHANNEL_NAME = "solano labs"
URL_TEMPLATE = "/api/v1/external/solano?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/solano?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "solano" WEBHOOK_DIR_NAME = "solano"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class SonarqubeHookTests(WebhookTestCase): class SonarqubeHookTests(WebhookTestCase):
STREAM_NAME = "SonarQube" CHANNEL_NAME = "SonarQube"
URL_TEMPLATE = "/api/v1/external/sonarqube?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/sonarqube?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "sonarqube" WEBHOOK_DIR_NAME = "sonarqube"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class SonarrHookTests(WebhookTestCase): class SonarrHookTests(WebhookTestCase):
STREAM_NAME = "sonarr" CHANNEL_NAME = "sonarr"
URL_TEMPLATE = "/api/v1/external/sonarr?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/sonarr?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "sonarr" WEBHOOK_DIR_NAME = "sonarr"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class SplunkHookTests(WebhookTestCase): class SplunkHookTests(WebhookTestCase):
STREAM_NAME = "splunk" CHANNEL_NAME = "splunk"
URL_TEMPLATE = "/api/v1/external/splunk?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/splunk?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "splunk" WEBHOOK_DIR_NAME = "splunk"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class StatuspageHookTests(WebhookTestCase): class StatuspageHookTests(WebhookTestCase):
STREAM_NAME = "statuspage-test" CHANNEL_NAME = "statuspage-test"
URL_TEMPLATE = "/api/v1/external/statuspage?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/statuspage?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "statuspage" WEBHOOK_DIR_NAME = "statuspage"

View File

@ -5,7 +5,7 @@ from zerver.lib.test_classes import WebhookTestCase
class StripeHookTests(WebhookTestCase): class StripeHookTests(WebhookTestCase):
STREAM_NAME = "test" CHANNEL_NAME = "test"
URL_TEMPLATE = "/api/v1/external/stripe?&api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/stripe?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "stripe" WEBHOOK_DIR_NAME = "stripe"

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class TaigaHookTests(WebhookTestCase): class TaigaHookTests(WebhookTestCase):
STREAM_NAME = "taiga" CHANNEL_NAME = "taiga"
TOPIC_NAME = "subject" TOPIC_NAME = "subject"
URL_TEMPLATE = "/api/v1/external/taiga?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/taiga?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "taiga" WEBHOOK_DIR_NAME = "taiga"

View File

@ -9,7 +9,7 @@ from zerver.webhooks.teamcity.view import MISCONFIGURED_PAYLOAD_TYPE_ERROR_MESSA
class TeamCityHookTests(WebhookTestCase): class TeamCityHookTests(WebhookTestCase):
STREAM_NAME = "teamcity" CHANNEL_NAME = "teamcity"
URL_TEMPLATE = "/api/v1/external/teamcity?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/teamcity?stream={stream}&api_key={api_key}"
TOPIC_NAME = "Project :: Compile" TOPIC_NAME = "Project :: Compile"
WEBHOOK_DIR_NAME = "teamcity" WEBHOOK_DIR_NAME = "teamcity"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class ThinkstHookTests(WebhookTestCase): class ThinkstHookTests(WebhookTestCase):
STREAM_NAME = "thinkst" CHANNEL_NAME = "thinkst"
URL_TEMPLATE = "/api/v1/external/thinkst?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/thinkst?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "thinkst" WEBHOOK_DIR_NAME = "thinkst"

View File

@ -6,7 +6,7 @@ from zerver.lib.test_classes import WebhookTestCase
class TransifexHookTests(WebhookTestCase): class TransifexHookTests(WebhookTestCase):
STREAM_NAME = "transifex" CHANNEL_NAME = "transifex"
URL_TEMPLATE = "/api/v1/external/transifex?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/transifex?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "transifex" WEBHOOK_DIR_NAME = "transifex"

View File

@ -6,7 +6,7 @@ from zerver.lib.test_classes import WebhookTestCase
class TravisHookTests(WebhookTestCase): class TravisHookTests(WebhookTestCase):
STREAM_NAME = "travis" CHANNEL_NAME = "travis"
URL_TEMPLATE = "/api/v1/external/travis?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/travis?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "travis" WEBHOOK_DIR_NAME = "travis"
TOPIC_NAME = "builds" TOPIC_NAME = "builds"

View File

@ -7,7 +7,7 @@ from zerver.lib.test_classes import WebhookTestCase
class TrelloHookTests(WebhookTestCase): class TrelloHookTests(WebhookTestCase):
STREAM_NAME = "trello" CHANNEL_NAME = "trello"
URL_TEMPLATE = "/api/v1/external/trello?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/trello?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "trello" WEBHOOK_DIR_NAME = "trello"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class UpdownHookTests(WebhookTestCase): class UpdownHookTests(WebhookTestCase):
STREAM_NAME = "updown" CHANNEL_NAME = "updown"
URL_TEMPLATE = "/api/v1/external/updown?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/updown?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "updown" WEBHOOK_DIR_NAME = "updown"
@ -27,7 +27,7 @@ class UpdownHookTests(WebhookTestCase):
down_content = "Service is `down`. It returned a 500 error at 2016-02-07 13:11:43 UTC." down_content = "Service is `down`. It returned a 500 error at 2016-02-07 13:11:43 UTC."
up_content = "Service is `up` again after 1 second." up_content = "Service is `up` again after 1 second."
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
payload = self.get_body("check_multiple_events") payload = self.get_body("check_multiple_events")
msg = self.send_webhook_payload( msg = self.send_webhook_payload(
@ -40,7 +40,7 @@ class UpdownHookTests(WebhookTestCase):
msg = self.get_second_to_last_message() msg = self.get_second_to_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=topic_name, topic_name=topic_name,
content=down_content, content=down_content,
) )
@ -48,7 +48,7 @@ class UpdownHookTests(WebhookTestCase):
msg = self.get_last_message() msg = self.get_last_message()
self.assert_stream_message( self.assert_stream_message(
message=msg, message=msg,
stream_name=self.STREAM_NAME, stream_name=self.CHANNEL_NAME,
topic_name=topic_name, topic_name=topic_name,
content=up_content, content=up_content,
) )

View File

@ -5,7 +5,7 @@ from zerver.webhooks.uptimerobot.view import MISCONFIGURED_PAYLOAD_ERROR_MESSAGE
class UptimeRobotHookTests(WebhookTestCase): class UptimeRobotHookTests(WebhookTestCase):
STREAM_NAME = "uptimerobot" CHANNEL_NAME = "uptimerobot"
URL_TEMPLATE = "/api/v1/external/uptimerobot?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/uptimerobot?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "uptimerobot" WEBHOOK_DIR_NAME = "uptimerobot"

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class WekanHookTests(WebhookTestCase): class WekanHookTests(WebhookTestCase):
STREAM_NAME = "wekan" CHANNEL_NAME = "wekan"
URL_TEMPLATE = "/api/v1/external/wekan?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/wekan?stream={stream}&api_key={api_key}"
FIXTURE_DIR_NAME = "wekan" FIXTURE_DIR_NAME = "wekan"

View File

@ -4,7 +4,7 @@ from zerver.lib.test_classes import WebhookTestCase
class WordPressHookTests(WebhookTestCase): class WordPressHookTests(WebhookTestCase):
STREAM_NAME = "wordpress" CHANNEL_NAME = "wordpress"
URL_TEMPLATE = "/api/v1/external/wordpress?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/wordpress?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "wordpress" WEBHOOK_DIR_NAME = "wordpress"
@ -84,7 +84,7 @@ class WordPressHookTests(WebhookTestCase):
# return if no params are sent. The fixture for this test is an empty file. # return if no params are sent. The fixture for this test is an empty file.
# subscribe to the target stream # subscribe to the target stream
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
# post to the webhook url # post to the webhook url
result = self.client_post( result = self.client_post(
@ -100,7 +100,7 @@ class WordPressHookTests(WebhookTestCase):
# Similar to unknown_action_no_data, except the fixture contains valid blog post # 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. # params but without the hook parameter. This should also return an error.
self.subscribe(self.test_user, self.STREAM_NAME) self.subscribe(self.test_user, self.CHANNEL_NAME)
result = self.client_post( result = self.client_post(
self.url, self.url,
self.get_body("unknown_action_no_hook_provided"), self.get_body("unknown_action_no_hook_provided"),

View File

@ -5,7 +5,7 @@ from zerver.webhooks.zabbix.view import MISCONFIGURED_PAYLOAD_ERROR_MESSAGE
class ZabbixHookTests(WebhookTestCase): class ZabbixHookTests(WebhookTestCase):
STREAM_NAME = "zabbix" CHANNEL_NAME = "zabbix"
URL_TEMPLATE = "/api/v1/external/zabbix?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/zabbix?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "zabbix" WEBHOOK_DIR_NAME = "zabbix"

View File

@ -2,7 +2,7 @@ from zerver.lib.test_classes import WebhookTestCase
class ZapierHookTests(WebhookTestCase): class ZapierHookTests(WebhookTestCase):
STREAM_NAME = "zapier" CHANNEL_NAME = "zapier"
URL_TEMPLATE = "/api/v1/external/zapier?stream={stream}&api_key={api_key}" URL_TEMPLATE = "/api/v1/external/zapier?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "zapier" WEBHOOK_DIR_NAME = "zapier"
@ -25,7 +25,7 @@ class ZapierHookTests(WebhookTestCase):
class ZapierZulipAppTests(WebhookTestCase): class ZapierZulipAppTests(WebhookTestCase):
STREAM_NAME = "zapier" CHANNEL_NAME = "zapier"
URL_TEMPLATE = "/api/v1/external/zapier?api_key={api_key}&stream={stream}" URL_TEMPLATE = "/api/v1/external/zapier?api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "zapier" WEBHOOK_DIR_NAME = "zapier"

View File

@ -6,7 +6,7 @@ from zerver.lib.test_classes import WebhookTestCase
class ZenDeskHookTests(WebhookTestCase): class ZenDeskHookTests(WebhookTestCase):
STREAM_NAME = "zendesk" CHANNEL_NAME = "zendesk"
URL_TEMPLATE = "/api/v1/external/zendesk?stream={stream}" URL_TEMPLATE = "/api/v1/external/zendesk?stream={stream}"
@override @override
@ -15,7 +15,7 @@ class ZenDeskHookTests(WebhookTestCase):
"ticket_title": self.TICKET_TITLE, "ticket_title": self.TICKET_TITLE,
"ticket_id": str(self.TICKET_ID), "ticket_id": str(self.TICKET_ID),
"message": self.MESSAGE, "message": self.MESSAGE,
"stream": self.STREAM_NAME, "stream": self.CHANNEL_NAME,
} }
def do_test(self, expected_topic: str, expected_message: str) -> None: def do_test(self, expected_topic: str, expected_message: str) -> None: