Skip to content

Commit

Permalink
chore(sentry_apps): Move SentryAppInstallationForProvider to sentry_a…
Browse files Browse the repository at this point in the history
…pps (#77738)

migrate SentryAppInstallationForProvider to sentry_apps!
[X] model
[] tests - N/A
[] typing - N/A
[] getsentry shim - N/A

issue ref(#73857)
  • Loading branch information
Christinarlong authored Sep 20, 2024
1 parent fbacb2d commit 460232f
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/sentry/deletions/defaults/sentry_app_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/integrations/vercel/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/integrations/vercel/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/sentry/models/authprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
)

Expand Down
8 changes: 1 addition & 7 deletions src/sentry/models/integrations/__init__.py
Original file line number Diff line number Diff line change
@@ -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
9 changes: 8 additions & 1 deletion src/sentry/sentry_apps/models/__init__.py
Original file line number Diff line number Diff line change
@@ -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",
)
6 changes: 3 additions & 3 deletions src/sentry/testutils/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/sentry/deletions/test_sentry_app_installations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/sentry/integrations/vercel/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/sentry/web/frontend/test_organization_auth_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 460232f

Please sign in to comment.