Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit d7732cc

Browse files
committed
Remove OwnerNotActivatedError
1 parent 70da0bf commit d7732cc

File tree

2 files changed

+6
-61
lines changed

2 files changed

+6
-61
lines changed

graphql_api/tests/test_repository.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -429,52 +429,6 @@ def test_repository_auto_activate(self, try_auto_activate):
429429
self.owner,
430430
)
431431

432-
@patch("services.activation.is_activated")
433-
@patch("services.activation.try_auto_activate")
434-
def test_repository_not_activated(self, try_auto_activate, is_activated):
435-
repo = RepositoryFactory(
436-
author=self.owner,
437-
active=True,
438-
private=True,
439-
coverage_enabled=True,
440-
bundle_analysis_enabled=True,
441-
test_analytics_enabled=True,
442-
)
443-
444-
is_activated.return_value = False
445-
446-
data = self.gql_request(
447-
query_repository % "name",
448-
owner=self.owner,
449-
variables={"name": repo.name},
450-
)
451-
assert data["me"]["owner"]["repository"] == {
452-
"__typename": "OwnerNotActivatedError",
453-
"message": "You must be activated in the org",
454-
}
455-
456-
@override_settings(IS_ENTERPRISE=True)
457-
@patch("services.activation.try_auto_activate")
458-
def test_repository_not_activated_self_hosted(self, try_auto_activate):
459-
repo = RepositoryFactory(
460-
author=self.owner,
461-
active=True,
462-
private=True,
463-
coverage_enabled=True,
464-
bundle_analysis_enabled=True,
465-
test_analytics_enabled=True,
466-
)
467-
468-
data = self.gql_request(
469-
query_repository % "name",
470-
owner=self.owner,
471-
variables={"name": repo.name},
472-
)
473-
assert data["me"]["owner"]["repository"] == {
474-
"__typename": "OwnerNotActivatedError",
475-
"message": "You must be activated in the org",
476-
}
477-
478432
@patch("services.activation.is_activated")
479433
@patch("services.activation.try_auto_activate")
480434
def test_resolve_inactive_user_on_unconfigured_repo(

graphql_api/types/owner/owner.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
require_shared_account_or_part_of_org,
3838
)
3939
from graphql_api.types.enums import OrderingDirection, RepositoryOrdering
40-
from graphql_api.types.errors.errors import NotFoundError, OwnerNotActivatedError
40+
from graphql_api.types.errors.errors import NotFoundError
4141
from graphql_api.types.repository.repository import TOKEN_UNAVAILABLE
4242
from plan.constants import FREE_PLAN_REPRESENTATIONS, PlanData, PlanName
4343
from plan.service import PlanService
@@ -162,24 +162,15 @@ async def resolve_repository(
162162
return NotFoundError()
163163

164164
current_owner = info.context["request"].current_owner
165-
product_flags = [
166-
repository.bundle_analysis_enabled,
167-
repository.coverage_enabled,
168-
repository.test_analytics_enabled,
169-
]
170-
has_products_enabled = any(product_flags)
171-
all_products_enabled = all(product_flags)
165+
has_products_enabled = (
166+
repository.bundle_analysis_enabled
167+
or repository.coverage_enabled
168+
or repository.test_analytics_enabled
169+
)
172170

173171
if repository.private and has_products_enabled:
174172
await sync_to_async(activation.try_auto_activate)(owner, current_owner)
175173

176-
is_owner_activated = await sync_to_async(activation.is_activated)(
177-
owner, current_owner
178-
)
179-
180-
if all_products_enabled and not is_owner_activated:
181-
return OwnerNotActivatedError()
182-
183174
info.context["profiling_summary"] = ProfilingSummary(repository)
184175
return repository
185176

0 commit comments

Comments
 (0)