diff --git a/src/sentry/options/defaults.py b/src/sentry/options/defaults.py index ef2f082045e4d4..9a0eecef8ad77c 100644 --- a/src/sentry/options/defaults.py +++ b/src/sentry/options/defaults.py @@ -1455,3 +1455,9 @@ default=[], flags=FLAG_PRIORITIZE_DISK | FLAG_AUTOMATOR_MODIFIABLE, ) + +register( + "options_automator_slack_webhook_enabled", + default=True, + flags=FLAG_AUTOMATOR_MODIFIABLE, +) diff --git a/src/sentry/runner/commands/presenters/slackpresenter.py b/src/sentry/runner/commands/presenters/slackpresenter.py index 6bdc3af1199468..cf9901b2e7dcf2 100644 --- a/src/sentry/runner/commands/presenters/slackpresenter.py +++ b/src/sentry/runner/commands/presenters/slackpresenter.py @@ -3,6 +3,7 @@ import requests from django.conf import settings +from sentry import options from sentry.runner.commands.presenters.optionspresenter import OptionsPresenter from sentry.utils import json @@ -29,7 +30,11 @@ def __init__(self) -> None: @staticmethod def is_slack_enabled(): - if not settings.OPTIONS_AUTOMATOR_SLACK_WEBHOOK_URL: + + if not ( + options.get("options_automator_slack_webhook_enabled") + and settings.OPTIONS_AUTOMATOR_SLACK_WEBHOOK_URL + ): return False try: test_payload: dict = { @@ -37,7 +42,7 @@ def is_slack_enabled(): "updated_options": [], "set_options": [], "unset_options": [], - "not_writable": [], + "not_writable_options": [], "unregistered_options": [], "invalid_type_options": [], } diff --git a/tests/sentry/runner/commands/presenters/test_slackpresenter.py b/tests/sentry/runner/commands/presenters/test_slackpresenter.py index 9e233c98a4f92d..4f29c7f13ebc00 100644 --- a/tests/sentry/runner/commands/presenters/test_slackpresenter.py +++ b/tests/sentry/runner/commands/presenters/test_slackpresenter.py @@ -16,6 +16,7 @@ def setup(self): def test_is_slack_enabled(self): responses.add(responses.POST, "https://test/", status=200) + assert self.slackPresenter.is_slack_enabled() self.slackPresenter.set("option1", "value1") self.slackPresenter.set("option2", "value2") @@ -75,5 +76,5 @@ def test_is_slack_enabled(self): ], } - assert responses.calls[0].response.status_code == 200 - assert expected_json_data == json.loads(responses.calls[0].request.body) + assert responses.calls[1].response.status_code == 200 + assert expected_json_data == json.loads(responses.calls[1].request.body)