Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_slack_integration: Use different name for channel name from API.
PieterCK1a2ae25bd039
diff --git a/zerver/webhooks/slack/fixtures/slack_conversations_info_api_response.json b/zerver/webhooks/slack/fixtures/slack_conversations_info_api_response.jsonindex 2fafb936540..19e8fb5195c 100644--- a/zerver/webhooks/slack/fixtures/slack_conversations_info_api_response.json+++ b/zerver/webhooks/slack/fixtures/slack_conversations_info_api_response.json@@ -2,7 +2,7 @@"ok": true,"channel": {"id": "C012AB3CD",- "name": "general",+ "name": "Slack general","is_channel": true,"is_group": false,"is_im": false,@@ -12,7 +12,7 @@"is_archived": false,"is_general": true,"unlinked": 0,- "name_normalized": "general",+ "name_normalized": "Slack general","is_shared": false,"is_frozen": false,"is_org_shared": false,diff --git a/zerver/webhooks/slack/tests.py b/zerver/webhooks/slack/tests.pyindex 40bb1a220a6..450155335f1 100644--- a/zerver/webhooks/slack/tests.py+++ b/zerver/webhooks/slack/tests.py@@ -14,6 +14,7 @@ EXPECTED_TOPIC = "Message from Slack"MESSAGE_WITH_NORMAL_TEXT = "Hello, this is a normal text message"USER = "John Doe"CHANNEL = "general"+API_CHANNEL_NAME = "Slack general"EXPECTED_MESSAGE = "**{user}**: {message}"TOPIC_WITH_CHANNEL = "channel: {channel}"@@ -28,6 +29,7 @@ def mock_slack_api_calls(@wraps(test_func)@responses.activatedef _wrapped(self: "SlackWebhookTests", /, *args: ParamT.args, **kwargs: ParamT.kwargs) -> None:+ self.make_stream(API_CHANNEL_NAME)responses.add(responses.GET,"https://slack.com/api/users.info",@@ -74,7 +76,7 @@ class SlackWebhookTests(WebhookTestCase):def test_slack_channels_map_to_topics_true(self) -> None:self.url = self.build_webhook_url(channels_map_to_topics="1")expected_message = EXPECTED_MESSAGE.format(user=USER, message=MESSAGE_WITH_NORMAL_TEXT)- expected_topic_name = TOPIC_WITH_CHANNEL.format(channel=CHANNEL)+ expected_topic_name = TOPIC_WITH_CHANNEL.format(channel=API_CHANNEL_NAME)self.check_webhook("message_with_normal_text",expected_topic_name,@@ -96,7 +98,7 @@ class SlackWebhookTests(WebhookTestCase):@mock_slack_api_callsdef test_slack_channels_map_to_topics_false(self) -> None:- self.CHANNEL_NAME = CHANNEL+ self.CHANNEL_NAME = API_CHANNEL_NAMEself.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(@@ -108,7 +110,7 @@ class SlackWebhookTests(WebhookTestCase):@mock_slack_api_callsdef test_slack_channels_map_to_topics_false_and_user_specified_topic(self) -> None:- self.CHANNEL_NAME = CHANNEL+ self.CHANNEL_NAME = API_CHANNEL_NAMEexpected_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)