diff --git a/src/sentry/deletions/defaults/sentry_app_installation.py b/src/sentry/deletions/defaults/sentry_app_installation.py index c064aea55ac0f2..8fe7906f714795 100644 --- a/src/sentry/deletions/defaults/sentry_app_installation.py +++ b/src/sentry/deletions/defaults/sentry_app_installation.py @@ -8,7 +8,7 @@ class SentryAppInstallationDeletionTask(ModelDeletionTask[SentryAppInstallation]): def get_child_relations(self, instance: SentryAppInstallation) -> list[BaseRelation]: from sentry.models.apigrant import ApiGrant - from sentry.models.integrations.sentry_app_installation_for_provider import ( + from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( SentryAppInstallationForProvider, ) from sentry.sentry_apps.models.sentry_app_installation_token import ( diff --git a/src/sentry/integrations/vercel/integration.py b/src/sentry/integrations/vercel/integration.py index b0ef97aaabf0c1..4e3549b9b342a9 100644 --- a/src/sentry/integrations/vercel/integration.py +++ b/src/sentry/integrations/vercel/integration.py @@ -19,14 +19,14 @@ ) from sentry.integrations.models.integration import Integration from sentry.integrations.services.integration import integration_service -from sentry.models.integrations.sentry_app_installation_for_provider import ( - SentryAppInstallationForProvider, -) from sentry.organizations.services.organization import RpcOrganizationSummary from sentry.pipeline import NestedPipelineView from sentry.projects.services.project_key import project_key_service from sentry.sentry_apps.logic import SentryAppCreator from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation +from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( + SentryAppInstallationForProvider, +) from sentry.sentry_apps.models.sentry_app_installation_token import SentryAppInstallationToken from sentry.shared_integrations.exceptions import ApiError, IntegrationError from sentry.users.models.user import User diff --git a/src/sentry/integrations/vercel/webhook.py b/src/sentry/integrations/vercel/webhook.py index 7813b1ce9b2a23..af9db32bcce275 100644 --- a/src/sentry/integrations/vercel/webhook.py +++ b/src/sentry/integrations/vercel/webhook.py @@ -19,11 +19,11 @@ from sentry.hybridcloud.services.organization_mapping import organization_mapping_service from sentry.integrations.models.integration import Integration from sentry.integrations.models.organization_integration import OrganizationIntegration -from sentry.models.integrations.sentry_app_installation_for_provider import ( - SentryAppInstallationForProvider, -) from sentry.models.project import Project from sentry.projects.services.project import project_service +from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( + SentryAppInstallationForProvider, +) from sentry.sentry_apps.models.sentry_app_installation_token import SentryAppInstallationToken from sentry.shared_integrations.exceptions import IntegrationError from sentry.utils.audit import create_audit_entry diff --git a/src/sentry/models/authprovider.py b/src/sentry/models/authprovider.py index 1e6c5ea4a5281d..3ba7be6bfa5f22 100644 --- a/src/sentry/models/authprovider.py +++ b/src/sentry/models/authprovider.py @@ -122,11 +122,11 @@ def get_scim_token(self): return get_scim_token(self.flags.scim_enabled, self.organization_id, self.provider) def enable_scim(self, user): - from sentry.models.integrations.sentry_app_installation_for_provider import ( - SentryAppInstallationForProvider, - ) from sentry.sentry_apps.logic import SentryAppCreator from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation + from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( + SentryAppInstallationForProvider, + ) if ( not self.get_provider().can_use_scim(self.organization_id, user) @@ -186,7 +186,7 @@ def outboxes_for_reset_idp_flags(self) -> list[ControlOutbox]: def disable_scim(self): from sentry import deletions - from sentry.models.integrations.sentry_app_installation_for_provider import ( + from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( SentryAppInstallationForProvider, ) diff --git a/src/sentry/models/integrations/__init__.py b/src/sentry/models/integrations/__init__.py index 3d7cd36200965e..c56c940a443d8a 100644 --- a/src/sentry/models/integrations/__init__.py +++ b/src/sentry/models/integrations/__init__.py @@ -1,12 +1,6 @@ -__all__ = ( - "SentryApp", - "SentryAppInstallationForProvider", -) +__all__ = ("SentryApp",) # REQUIRED for migrations to run. from sentry.integrations.types import ExternalProviders # NOQA -from sentry.models.integrations.sentry_app_installation_for_provider import ( - SentryAppInstallationForProvider, -) from sentry.sentry_apps.models.sentry_app import SentryApp diff --git a/src/sentry/sentry_apps/models/__init__.py b/src/sentry/sentry_apps/models/__init__.py index eeaffc28f173ea..79e8f09cefa065 100644 --- a/src/sentry/sentry_apps/models/__init__.py +++ b/src/sentry/sentry_apps/models/__init__.py @@ -1,6 +1,13 @@ from .sentry_app import SentryApp from .sentry_app_component import SentryAppComponent from .sentry_app_installation import SentryAppInstallation +from .sentry_app_installation_for_provider import SentryAppInstallationForProvider from .sentry_app_installation_token import SentryAppInstallationToken -__all__ = ("SentryApp", "SentryAppInstallationToken", "SentryAppInstallation", "SentryAppComponent") +__all__ = ( + "SentryApp", + "SentryAppInstallationToken", + "SentryAppInstallation", + "SentryAppInstallationForProvider", + "SentryAppComponent", +) diff --git a/src/sentry/models/integrations/sentry_app_installation_for_provider.py b/src/sentry/sentry_apps/models/sentry_app_installation_for_provider.py similarity index 100% rename from src/sentry/models/integrations/sentry_app_installation_for_provider.py rename to src/sentry/sentry_apps/models/sentry_app_installation_for_provider.py diff --git a/src/sentry/testutils/factories.py b/src/sentry/testutils/factories.py index e316e6ae9ed13a..c775273d5183fa 100644 --- a/src/sentry/testutils/factories.py +++ b/src/sentry/testutils/factories.py @@ -101,9 +101,6 @@ from sentry.models.grouphistory import GroupHistory from sentry.models.grouplink import GroupLink from sentry.models.grouprelease import GroupRelease -from sentry.models.integrations.sentry_app_installation_for_provider import ( - SentryAppInstallationForProvider, -) from sentry.models.notificationaction import ( ActionService, ActionTarget, @@ -142,6 +139,9 @@ from sentry.sentry_apps.logic import SentryAppCreator from sentry.sentry_apps.models.sentry_app import SentryApp from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation +from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( + SentryAppInstallationForProvider, +) from sentry.sentry_apps.services.app.serial import serialize_sentry_app_installation from sentry.sentry_apps.services.hook import hook_service from sentry.signals import project_created diff --git a/tests/sentry/deletions/test_sentry_app_installations.py b/tests/sentry/deletions/test_sentry_app_installations.py index b81e492f46113e..73c3202d2026b6 100644 --- a/tests/sentry/deletions/test_sentry_app_installations.py +++ b/tests/sentry/deletions/test_sentry_app_installations.py @@ -6,12 +6,12 @@ from sentry.deletions.tasks.hybrid_cloud import schedule_hybrid_cloud_foreign_key_jobs from sentry.models.apigrant import ApiGrant from sentry.models.apitoken import ApiToken -from sentry.models.integrations.sentry_app_installation_for_provider import ( - SentryAppInstallationForProvider, -) from sentry.models.servicehook import ServiceHook from sentry.sentry_apps.installations import SentryAppInstallationCreator from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation +from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( + SentryAppInstallationForProvider, +) from sentry.silo.base import SiloMode from sentry.silo.safety import unguarded_write from sentry.testutils.cases import TestCase diff --git a/tests/sentry/integrations/vercel/test_integration.py b/tests/sentry/integrations/vercel/test_integration.py index 133e6b7c769d81..1d27e061128ee7 100644 --- a/tests/sentry/integrations/vercel/test_integration.py +++ b/tests/sentry/integrations/vercel/test_integration.py @@ -10,13 +10,13 @@ from sentry.integrations.models.integration import Integration from sentry.integrations.models.organization_integration import OrganizationIntegration from sentry.integrations.vercel import VercelClient, VercelIntegrationProvider -from sentry.models.integrations.sentry_app_installation_for_provider import ( - SentryAppInstallationForProvider, -) from sentry.models.project import Project from sentry.models.projectkey import ProjectKey, ProjectKeyStatus from sentry.models.scheduledeletion import ScheduledDeletion from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation +from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( + SentryAppInstallationForProvider, +) from sentry.sentry_apps.models.sentry_app_installation_token import SentryAppInstallationToken from sentry.silo.base import SiloMode from sentry.testutils.cases import IntegrationTestCase diff --git a/tests/sentry/sentry_apps/models/test_sentryappinstallationtoken.py b/tests/sentry/sentry_apps/models/test_sentryappinstallationtoken.py index 9c22242552be7b..b4481fa5b7ca0f 100644 --- a/tests/sentry/sentry_apps/models/test_sentryappinstallationtoken.py +++ b/tests/sentry/sentry_apps/models/test_sentryappinstallationtoken.py @@ -1,9 +1,9 @@ from sentry.models.apiapplication import ApiApplication from sentry.models.apitoken import ApiToken -from sentry.models.integrations.sentry_app_installation_for_provider import ( +from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation +from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( SentryAppInstallationForProvider, ) -from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation from sentry.sentry_apps.models.sentry_app_installation_token import SentryAppInstallationToken from sentry.testutils.cases import TestCase from sentry.testutils.silo import control_silo_test diff --git a/tests/sentry/web/frontend/test_organization_auth_settings.py b/tests/sentry/web/frontend/test_organization_auth_settings.py index ea6a3e1622607f..ec8b382d25e77e 100644 --- a/tests/sentry/web/frontend/test_organization_auth_settings.py +++ b/tests/sentry/web/frontend/test_organization_auth_settings.py @@ -20,13 +20,13 @@ from sentry.models.authidentity import AuthIdentity from sentry.models.authprovider import AuthProvider from sentry.models.authproviderreplica import AuthProviderReplica -from sentry.models.integrations.sentry_app_installation_for_provider import ( - SentryAppInstallationForProvider, -) from sentry.models.organization import Organization from sentry.models.organizationmember import OrganizationMember from sentry.models.team import Team from sentry.organizations.services.organization import organization_service +from sentry.sentry_apps.models.sentry_app_installation_for_provider import ( + SentryAppInstallationForProvider, +) from sentry.signals import receivers_raise_on_send from sentry.silo.base import SiloMode from sentry.testutils.cases import AuthProviderTestCase, PermissionTestCase