Skip to content

Commit b60aee0

Browse files
Zaimwa9claude
andcommitted
test(cohorts): make membership-count query assertion RBAC-agnostic
The private-package CI run installs RBAC, whose runtime role checks add two permission queries, failing the hardcoded count of 10. Force IS_RBAC_INSTALLED off for this test so the count is deterministic in both variants; the test's subject is cohort membership counts staying constant, not the permission stack. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 1b5cb0c commit b60aee0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

api/tests/unit/cohorts/test_views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
)
3232

3333
if typing.TYPE_CHECKING:
34-
from pytest_django.fixtures import DjangoAssertNumQueries
34+
from pytest_django.fixtures import DjangoAssertNumQueries, SettingsWrapper
3535

3636

3737
def test_create_cohort__staff_with_manage_segments__returns_201(
@@ -177,8 +177,12 @@ def test_list_cohorts__multiple_cohorts__membership_counts_in_constant_queries(
177177
dynamodb_identity_wrapper: DynamoIdentityWrapper,
178178
with_environment_permissions: WithEnvironmentPermissionsCallable,
179179
django_assert_num_queries: "DjangoAssertNumQueries",
180+
settings: "SettingsWrapper",
180181
) -> None:
181182
# Given
183+
# Keep the query count deterministic across OSS and private-package
184+
# runs: RBAC's runtime role checks would add two permission queries.
185+
settings.IS_RBAC_INSTALLED = False
182186
environment = edge_cohort.environment
183187
with_environment_permissions( # type: ignore[call-arg]
184188
[VIEW_ENVIRONMENT], environment_id=environment.id

0 commit comments

Comments
 (0)