diff --git a/graphql_api/tests/test_repository.py b/graphql_api/tests/test_repository.py index 5d1aac5659..c3cbbed093 100644 --- a/graphql_api/tests/test_repository.py +++ b/graphql_api/tests/test_repository.py @@ -429,50 +429,6 @@ def test_repository_auto_activate(self, try_auto_activate): self.owner, ) - @patch("services.activation.is_activated") - @patch("services.activation.try_auto_activate") - def test_repository_not_activated(self, try_auto_activate, is_activated): - repo = RepositoryFactory( - author=self.owner, - active=True, - private=True, - coverage_enabled=True, - bundle_analysis_enabled=True, - ) - - is_activated.return_value = False - - data = self.gql_request( - query_repository % "name", - owner=self.owner, - variables={"name": repo.name}, - ) - assert data["me"]["owner"]["repository"] == { - "__typename": "OwnerNotActivatedError", - "message": "You must be activated in the org", - } - - @override_settings(IS_ENTERPRISE=True) - @patch("services.activation.try_auto_activate") - def test_repository_not_activated_self_hosted(self, try_auto_activate): - repo = RepositoryFactory( - author=self.owner, - active=True, - private=True, - coverage_enabled=True, - bundle_analysis_enabled=True, - ) - - data = self.gql_request( - query_repository % "name", - owner=self.owner, - variables={"name": repo.name}, - ) - assert data["me"]["owner"]["repository"] == { - "__typename": "OwnerNotActivatedError", - "message": "You must be activated in the org", - } - @patch("services.activation.is_activated") @patch("services.activation.try_auto_activate") def test_resolve_inactive_user_on_unconfigured_repo( diff --git a/graphql_api/types/owner/owner.py b/graphql_api/types/owner/owner.py index 40fa259771..7cca4f9ac1 100644 --- a/graphql_api/types/owner/owner.py +++ b/graphql_api/types/owner/owner.py @@ -37,7 +37,7 @@ require_shared_account_or_part_of_org, ) from graphql_api.types.enums import OrderingDirection, RepositoryOrdering -from graphql_api.types.errors.errors import NotFoundError, OwnerNotActivatedError +from graphql_api.types.errors.errors import NotFoundError from graphql_api.types.repository.repository import TOKEN_UNAVAILABLE from plan.constants import FREE_PLAN_REPRESENTATIONS, PlanData, PlanName from plan.service import PlanService @@ -163,16 +163,13 @@ async def resolve_repository( current_owner = info.context["request"].current_owner has_products_enabled = ( - repository.bundle_analysis_enabled and repository.coverage_enabled + repository.bundle_analysis_enabled + or repository.coverage_enabled + or repository.test_analytics_enabled ) if repository.private and has_products_enabled: await sync_to_async(activation.try_auto_activate)(owner, current_owner) - is_owner_activated = await sync_to_async(activation.is_activated)( - owner, current_owner - ) - if not is_owner_activated: - return OwnerNotActivatedError() info.context["profiling_summary"] = ProfilingSummary(repository) return repository diff --git a/services/activation.py b/services/activation.py index 033403ba88..b69326d7f1 100644 --- a/services/activation.py +++ b/services/activation.py @@ -71,7 +71,7 @@ def _get_activator(org: Owner, owner: Owner) -> BaseActivator: def try_auto_activate(org: Owner, owner: Owner) -> bool: """ - Returns true iff the user was able to be activated, false otherwise. + Returns true if the user was able to be activated, false otherwise. """ activator = _get_activator(org, owner)