diff --git a/src/sentry/api/endpoints/integrations/sentry_apps/__init__.py b/src/sentry/api/endpoints/integrations/sentry_apps/__init__.py index 140934cc533b6e..a6a8d05d8ed9dc 100644 --- a/src/sentry/api/endpoints/integrations/sentry_apps/__init__.py +++ b/src/sentry/api/endpoints/integrations/sentry_apps/__init__.py @@ -3,12 +3,6 @@ from .details import SentryAppDetailsEndpoint from .features import SentryAppFeaturesEndpoint from .index import SentryAppsEndpoint -from .installation.details import SentryAppInstallationDetailsEndpoint -from .installation.external_issue.actions import SentryAppInstallationExternalIssueActionsEndpoint -from .installation.external_issue.details import SentryAppInstallationExternalIssueDetailsEndpoint -from .installation.external_issue.index import SentryAppInstallationExternalIssuesEndpoint -from .installation.external_requests import SentryAppInstallationExternalRequestsEndpoint -from .installation.index import SentryAppInstallationsEndpoint from .interaction import SentryAppInteractionEndpoint from .internal_app_token.details import SentryInternalAppTokenDetailsEndpoint from .internal_app_token.index import SentryInternalAppTokensEndpoint @@ -26,12 +20,6 @@ "SentryAppComponentsEndpoint", "SentryAppDetailsEndpoint", "SentryAppFeaturesEndpoint", - "SentryAppInstallationDetailsEndpoint", - "SentryAppInstallationExternalIssueActionsEndpoint", - "SentryAppInstallationExternalIssueDetailsEndpoint", - "SentryAppInstallationExternalIssuesEndpoint", - "SentryAppInstallationExternalRequestsEndpoint", - "SentryAppInstallationsEndpoint", "SentryAppInteractionEndpoint", "SentryAppPublishRequestEndpoint", "SentryAppRequestsEndpoint", diff --git a/src/sentry/api/urls.py b/src/sentry/api/urls.py index 7ed0ee60551096..483654466288ed 100644 --- a/src/sentry/api/urls.py +++ b/src/sentry/api/urls.py @@ -273,6 +273,22 @@ from sentry.scim.endpoints.members import OrganizationSCIMMemberDetails, OrganizationSCIMMemberIndex from sentry.scim.endpoints.schemas import OrganizationSCIMSchemaIndex from sentry.scim.endpoints.teams import OrganizationSCIMTeamDetails, OrganizationSCIMTeamIndex +from sentry.sentry_apps.api.endpoints.installation_details import ( + SentryAppInstallationDetailsEndpoint, +) +from sentry.sentry_apps.api.endpoints.installation_external_issue_actions import ( + SentryAppInstallationExternalIssueActionsEndpoint, +) +from sentry.sentry_apps.api.endpoints.installation_external_issue_details import ( + SentryAppInstallationExternalIssueDetailsEndpoint, +) +from sentry.sentry_apps.api.endpoints.installation_external_issues import ( + SentryAppInstallationExternalIssuesEndpoint, +) +from sentry.sentry_apps.api.endpoints.installation_external_requests import ( + SentryAppInstallationExternalRequestsEndpoint, +) +from sentry.sentry_apps.api.endpoints.sentry_app_installations import SentryAppInstallationsEndpoint from sentry.uptime.endpoints.project_uptime_alert_details import ProjectUptimeAlertDetailsEndpoint from sentry.uptime.endpoints.project_uptime_alert_index import ProjectUptimeAlertIndexEndpoint from sentry.users.api.endpoints.authenticator_index import AuthenticatorIndexEndpoint @@ -368,12 +384,6 @@ SentryAppComponentsEndpoint, SentryAppDetailsEndpoint, SentryAppFeaturesEndpoint, - SentryAppInstallationDetailsEndpoint, - SentryAppInstallationExternalIssueActionsEndpoint, - SentryAppInstallationExternalIssueDetailsEndpoint, - SentryAppInstallationExternalIssuesEndpoint, - SentryAppInstallationExternalRequestsEndpoint, - SentryAppInstallationsEndpoint, SentryAppInteractionEndpoint, SentryAppPublishRequestEndpoint, SentryAppRequestsEndpoint, diff --git a/src/sentry/api/endpoints/integrations/sentry_apps/installation/__init__.py b/src/sentry/sentry_apps/api/endpoints/__init__.py similarity index 100% rename from src/sentry/api/endpoints/integrations/sentry_apps/installation/__init__.py rename to src/sentry/sentry_apps/api/endpoints/__init__.py diff --git a/src/sentry/api/endpoints/integrations/sentry_apps/installation/details.py b/src/sentry/sentry_apps/api/endpoints/installation_details.py similarity index 100% rename from src/sentry/api/endpoints/integrations/sentry_apps/installation/details.py rename to src/sentry/sentry_apps/api/endpoints/installation_details.py diff --git a/src/sentry/api/endpoints/integrations/sentry_apps/installation/external_issue/actions.py b/src/sentry/sentry_apps/api/endpoints/installation_external_issue_actions.py similarity index 100% rename from src/sentry/api/endpoints/integrations/sentry_apps/installation/external_issue/actions.py rename to src/sentry/sentry_apps/api/endpoints/installation_external_issue_actions.py diff --git a/src/sentry/api/endpoints/integrations/sentry_apps/installation/external_issue/details.py b/src/sentry/sentry_apps/api/endpoints/installation_external_issue_details.py similarity index 100% rename from src/sentry/api/endpoints/integrations/sentry_apps/installation/external_issue/details.py rename to src/sentry/sentry_apps/api/endpoints/installation_external_issue_details.py diff --git a/src/sentry/api/endpoints/integrations/sentry_apps/installation/external_issue/index.py b/src/sentry/sentry_apps/api/endpoints/installation_external_issues.py similarity index 100% rename from src/sentry/api/endpoints/integrations/sentry_apps/installation/external_issue/index.py rename to src/sentry/sentry_apps/api/endpoints/installation_external_issues.py diff --git a/src/sentry/api/endpoints/integrations/sentry_apps/installation/external_requests.py b/src/sentry/sentry_apps/api/endpoints/installation_external_requests.py similarity index 100% rename from src/sentry/api/endpoints/integrations/sentry_apps/installation/external_requests.py rename to src/sentry/sentry_apps/api/endpoints/installation_external_requests.py diff --git a/src/sentry/api/endpoints/integrations/sentry_apps/installation/index.py b/src/sentry/sentry_apps/api/endpoints/sentry_app_installations.py similarity index 95% rename from src/sentry/api/endpoints/integrations/sentry_apps/installation/index.py rename to src/sentry/sentry_apps/api/endpoints/sentry_app_installations.py index 5e2be9dfecbdfa..a0d811f2095951 100644 --- a/src/sentry/api/endpoints/integrations/sentry_apps/installation/index.py +++ b/src/sentry/sentry_apps/api/endpoints/sentry_app_installations.py @@ -17,6 +17,7 @@ from sentry.sentry_apps.installations import SentryAppInstallationCreator from sentry.sentry_apps.models.sentry_app import SentryApp from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation +from sentry.users.models.user import User class SentryAppInstallationsSerializer(serializers.Serializer): @@ -90,6 +91,9 @@ def post(self, request: Request, organization) -> Response: sentry_app__slug=slug, organization_id=organization.id ) except SentryAppInstallation.DoesNotExist: + assert isinstance( + request.user, User + ), "user must be authenticated to create a SentryAppInstallation" install = SentryAppInstallationCreator( organization_id=organization.id, slug=slug, notify=True ).run(user=request.user, request=request) diff --git a/tests/sentry/api/endpoints/test_organization_sentry_app_installation_details.py b/tests/sentry/sentry_apps/api/endpoints/test_organization_sentry_app_installation_details.py similarity index 100% rename from tests/sentry/api/endpoints/test_organization_sentry_app_installation_details.py rename to tests/sentry/sentry_apps/api/endpoints/test_organization_sentry_app_installation_details.py diff --git a/tests/sentry/api/endpoints/test_organization_sentry_app_installations.py b/tests/sentry/sentry_apps/api/endpoints/test_organization_sentry_app_installations.py similarity index 100% rename from tests/sentry/api/endpoints/test_organization_sentry_app_installations.py rename to tests/sentry/sentry_apps/api/endpoints/test_organization_sentry_app_installations.py diff --git a/tests/sentry/api/endpoints/test_sentry_app_installation_external_issue_actions.py b/tests/sentry/sentry_apps/api/endpoints/test_sentry_app_installation_external_issue_actions.py similarity index 100% rename from tests/sentry/api/endpoints/test_sentry_app_installation_external_issue_actions.py rename to tests/sentry/sentry_apps/api/endpoints/test_sentry_app_installation_external_issue_actions.py diff --git a/tests/sentry/api/endpoints/test_sentry_app_installation_external_issue_details.py b/tests/sentry/sentry_apps/api/endpoints/test_sentry_app_installation_external_issue_details.py similarity index 100% rename from tests/sentry/api/endpoints/test_sentry_app_installation_external_issue_details.py rename to tests/sentry/sentry_apps/api/endpoints/test_sentry_app_installation_external_issue_details.py diff --git a/tests/sentry/api/endpoints/test_sentry_app_installation_external_issues.py b/tests/sentry/sentry_apps/api/endpoints/test_sentry_app_installation_external_issues.py similarity index 100% rename from tests/sentry/api/endpoints/test_sentry_app_installation_external_issues.py rename to tests/sentry/sentry_apps/api/endpoints/test_sentry_app_installation_external_issues.py diff --git a/tests/sentry/api/endpoints/test_sentry_app_installation_external_requests.py b/tests/sentry/sentry_apps/api/endpoints/test_sentry_app_installation_external_requests.py similarity index 100% rename from tests/sentry/api/endpoints/test_sentry_app_installation_external_requests.py rename to tests/sentry/sentry_apps/api/endpoints/test_sentry_app_installation_external_requests.py