Skip to content

Commit

Permalink
chore(slack): Remove Slack SDK Related Options (#76601)
Browse files Browse the repository at this point in the history
found some options we don't use anymore, since we gave GAed for a while.
  • Loading branch information
iamrajjoshi committed Aug 27, 2024
1 parent e1767e4 commit fdf64ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
13 changes: 0 additions & 13 deletions src/sentry/options/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,19 +500,6 @@
# signing-secret is preferred, but need to keep verification-token for apps that use it
register("slack.verification-token", flags=FLAG_CREDENTIAL | FLAG_PRIORITIZE_DISK)
register("slack.signing-secret", flags=FLAG_CREDENTIAL | FLAG_PRIORITIZE_DISK)
# Use Slack SDK in SlackEventEndpoint
register(
"slack.event-endpoint-sdk",
default=False,
flags=FLAG_AUTOMATOR_MODIFIABLE,
)
# Integration Ids to LA for Using Slack SDK in SlackEventEndpoint
register(
"slack.event-endpoint-sdk-integration-ids",
type=Sequence,
default=[],
flags=FLAG_ALLOW_EMPTY | FLAG_AUTOMATOR_MODIFIABLE,
)

# Codecov Integration
register("codecov.client-secret", flags=FLAG_CREDENTIAL | FLAG_PRIORITIZE_DISK)
Expand Down
27 changes: 6 additions & 21 deletions tests/sentry/integrations/slack/webhooks/events/test_message_im.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import orjson
import pytest
import responses
from slack_sdk.web import SlackResponse

from sentry.silo.base import SiloMode
from sentry.testutils.cases import IntegratedApiTestCase
from sentry.testutils.helpers import get_response_text, override_options
from sentry.testutils.helpers import get_response_text
from sentry.testutils.silo import assume_test_silo_mode
from sentry.users.models.identity import Identity, IdentityStatus

Expand Down Expand Up @@ -75,20 +74,13 @@ def mock_chat_postMessage(self):
) as self.mock_post:
yield

def test_identifying_channel_correctly_sdk(self):
def test_identifying_channel_correctly(self):
event_data = orjson.loads(MESSAGE_IM_EVENT)
self.post_webhook(event_data=event_data)
data = self.mock_post.call_args[1]
assert data.get("channel") == event_data["channel"]

def test_identifying_channel_correctly_sdk_la(self):
with override_options({"slack.event-endpoint-sdk-integration-ids": [self.integration.id]}):
event_data = orjson.loads(MESSAGE_IM_EVENT)
self.post_webhook(event_data=event_data)
data = self.mock_post.call_args[1]
assert data.get("channel") == event_data["channel"]

def test_user_message_im_notification_platform_sdk(self):
def test_user_message_im_notification_platform(self):
resp = self.post_webhook(event_data=orjson.loads(MESSAGE_IM_EVENT))
assert resp.status_code == 200, resp.content

Expand All @@ -100,7 +92,7 @@ def test_user_message_im_notification_platform_sdk(self):
== "Here are the commands you can use. Commands not working? Re-install the app!"
)

def test_user_message_link_sdk(self):
def test_user_message_link(self):
"""
Test that when a user types in "link" to the DM we reply with the correct response.
"""
Expand Down Expand Up @@ -134,7 +126,7 @@ def test_user_message_already_linked_sdk(self):
data = self.mock_post.call_args[1]
assert "You are already linked" in get_response_text(data)

def test_user_message_unlink_sdk(self):
def test_user_message_unlink(self):
"""
Test that when a user types in "unlink" to the DM we reply with the correct response.
"""
Expand All @@ -154,7 +146,7 @@ def test_user_message_unlink_sdk(self):
data = self.mock_post.call_args[1]
assert "Click here to unlink your identity" in get_response_text(data)

def test_user_message_already_unlinked_sdk(self):
def test_user_message_already_unlinked(self):
"""
Test that when a user without an Identity types in "unlink" to the DM we
reply with the correct response.
Expand All @@ -172,14 +164,7 @@ def test_bot_message_im(self):
resp = self.post_webhook(event_data=orjson.loads(MESSAGE_IM_BOT_EVENT))
assert resp.status_code == 200, resp.content

@responses.activate
def test_user_message_im_no_text(self):
responses.add(responses.POST, "https://slack.com/api/chat.postMessage", json={"ok": True})
resp = self.post_webhook(event_data=orjson.loads(MESSAGE_IM_EVENT_NO_TEXT))
assert resp.status_code == 200, resp.content
assert len(responses.calls) == 0

def test_user_message_im_no_text_sdk(self):
resp = self.post_webhook(event_data=orjson.loads(MESSAGE_IM_EVENT_NO_TEXT))
assert resp.status_code == 200, resp.content
assert not self.mock_post.called

0 comments on commit fdf64ec

Please sign in to comment.