|
3 | 3 | build_action_response,
|
4 | 4 | )
|
5 | 5 | from sentry.incidents.models import AlertRuleTriggerAction
|
| 6 | +from sentry.models.integrations import SentryAppComponent, SentryAppInstallation |
6 | 7 | from sentry.models.integrations.integration import Integration
|
7 | 8 | from sentry.models.integrations.organization_integration import OrganizationIntegration
|
8 | 9 | from sentry.services.hybrid_cloud.app.serial import serialize_sentry_app_installation
|
@@ -39,7 +40,7 @@ def setUp(self):
|
39 | 40 | super().setUp()
|
40 | 41 | self.login_as(self.user)
|
41 | 42 |
|
42 |
| - def install_new_sentry_app(self, name, **kwargs): |
| 43 | + def install_new_sentry_app(self, name, **kwargs) -> SentryAppInstallation: |
43 | 44 | kwargs.update(
|
44 | 45 | name=name, organization=self.organization, is_alertable=True, verify_install=False
|
45 | 46 | )
|
@@ -118,6 +119,22 @@ def test_build_action_response_sentry_app(self):
|
118 | 119 | assert data["allowedTargetTypes"] == ["sentry_app"]
|
119 | 120 | assert data["status"] == SentryAppStatus.UNPUBLISHED_STR
|
120 | 121 |
|
| 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 | + |
121 | 138 | def test_no_integrations(self):
|
122 | 139 | with self.feature("organizations:incidents"):
|
123 | 140 | response = self.get_success_response(self.organization.slug)
|
|
0 commit comments