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

Commit 70da0bf

Browse files
committed
fix tests
1 parent 90f4451 commit 70da0bf

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

graphql_api/tests/test_repository.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ def test_repository_not_activated(self, try_auto_activate, is_activated):
438438
private=True,
439439
coverage_enabled=True,
440440
bundle_analysis_enabled=True,
441+
test_analytics_enabled=True,
441442
)
442443

443444
is_activated.return_value = False
@@ -461,6 +462,7 @@ def test_repository_not_activated_self_hosted(self, try_auto_activate):
461462
private=True,
462463
coverage_enabled=True,
463464
bundle_analysis_enabled=True,
465+
test_analytics_enabled=True,
464466
)
465467

466468
data = self.gql_request(

graphql_api/types/owner/owner.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,23 @@ async def resolve_repository(
162162
return NotFoundError()
163163

164164
current_owner = info.context["request"].current_owner
165-
has_products_enabled = (
166-
repository.bundle_analysis_enabled
167-
or repository.coverage_enabled
168-
or repository.test_analytics_enabled
169-
)
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)
170172

171173
if repository.private and has_products_enabled:
172174
await sync_to_async(activation.try_auto_activate)(owner, current_owner)
173-
is_owner_activated = await sync_to_async(activation.is_activated)(
174-
owner, current_owner
175-
)
176-
if not is_owner_activated:
177-
return OwnerNotActivatedError()
175+
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()
178182

179183
info.context["profiling_summary"] = ProfilingSummary(repository)
180184
return repository

services/activation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _get_activator(org: Owner, owner: Owner) -> BaseActivator:
7171

7272
def try_auto_activate(org: Owner, owner: Owner) -> bool:
7373
"""
74-
Returns true iff the user was able to be activated, false otherwise.
74+
Returns true if the user was able to be activated, false otherwise.
7575
"""
7676
activator = _get_activator(org, owner)
7777

0 commit comments

Comments
 (0)