Skip to content

Commit 93c8f9c

Browse files
committed
Debug and add test case
1 parent 08be39d commit 93c8f9c

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Diff for: src/sentry/incidents/endpoints/organization_alert_rule_available_action_index.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def build_action_response(
7373
installation_id=sentry_app_installation.id, component_type="alert-rule-action"
7474
)
7575
if component:
76-
action_response["settings"] = component.schema.get("settings", {})
76+
action_response["settings"] = component.app_schema.get("settings", {})
7777

7878
return action_response
7979

Diff for: tests/sentry/incidents/endpoints/test_organization_alert_rule_available_action_index.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
build_action_response,
44
)
55
from sentry.incidents.models import AlertRuleTriggerAction
6+
from sentry.models.integrations import SentryAppComponent, SentryAppInstallation
67
from sentry.models.integrations.integration import Integration
78
from sentry.models.integrations.organization_integration import OrganizationIntegration
89
from sentry.services.hybrid_cloud.app.serial import serialize_sentry_app_installation
@@ -39,7 +40,7 @@ def setUp(self):
3940
super().setUp()
4041
self.login_as(self.user)
4142

42-
def install_new_sentry_app(self, name, **kwargs):
43+
def install_new_sentry_app(self, name, **kwargs) -> SentryAppInstallation:
4344
kwargs.update(
4445
name=name, organization=self.organization, is_alertable=True, verify_install=False
4546
)
@@ -118,6 +119,22 @@ def test_build_action_response_sentry_app(self):
118119
assert data["allowedTargetTypes"] == ["sentry_app"]
119120
assert data["status"] == SentryAppStatus.UNPUBLISHED_STR
120121

122+
def test_build_action_response_sentry_app_with_component(self):
123+
installation = self.install_new_sentry_app("foo")
124+
test_settings = {"test-settings": []}
125+
with assume_test_silo_mode(SiloMode.CONTROL):
126+
SentryAppComponent.objects.create(
127+
sentry_app=installation.sentry_app,
128+
type="alert-rule-action",
129+
schema={"settings": test_settings},
130+
)
131+
132+
data = build_action_response(
133+
self.sentry_app, sentry_app_installation=serialize_sentry_app_installation(installation)
134+
)
135+
136+
assert data["settings"] == test_settings
137+
121138
def test_no_integrations(self):
122139
with self.feature("organizations:incidents"):
123140
response = self.get_success_response(self.organization.slug)

0 commit comments

Comments
 (0)