Conversation
The grant cutover left the same fixture dance copy-pasted across suites: create a leftover PermissionGroup row (nothing provisions grant-only templates any more), add a membership, and drop the auto-mirrored Grant. - common/tests/utils.py: `make_permission_group` (an org row created on demand), `revoke_grants` (the grantless-member state), `add_legacy_membership` (membership without the mirror), and the composite `make_legacy_only_holder`. - adopt in the teams / reports / member-management grant-authorization suites; - test_roles: drop the local `_add_legacy_membership` / `_legacy_org_admin_group` copies in favour of the shared helpers; - test_role_manager_grants / test_permission_group: use `make_permission_group`; - shelters room/bed/reservation queries: `revoke_grants(self.operator)` replaces the inline Grant delete. Validation: accounts+common+reports+teams+shelters — 1310 passed; ruff clean.
Contributor
Reviewer's GuideThis test-only PR consolidates legacy permission-group and grantless-member fixture setup into reusable helpers, then applies them across authorization, role-backfill, permission-group, and shelter query suites without changing production code. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
CI lint (uv run ruff format --check .) caught a wrap that fits on one line (108 < 120 columns).
vecchp
pushed a commit
that referenced
this pull request
Sep 10, 2026
…y, nits
F1 reconcile_org_groups unmirrors stale derived rows before deleting them,
so an org-type change fully revokes (mirrored Grants no longer survive
config cleanup); teardown deletes keep leaving Grants standing.
F2 signal docstring states the sanctioned exception precisely (m2m-manager
writers only); helper duplication already consolidated in #2451.
F3 same-row direct-grant revocation pinned by test + GrantAdmin fieldset
description (unique constraint makes both grants one row).
F4 moot — accounts/extensions.py deleted in 590dc50.
F5 set(dict) -> .keys().
F6 stale delete_orphaned_group refs corrected (services.py, admin.py);
tear-down described as the structural MTI cascade (migration 0007).
F7 LoadedRowRawIdWidget preserves the original widget's using kwarg.
F8 teams/tests/test_authz_registry.py canary added (4 fields).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Consolidates the legacy-only fixture dance the grant cutover left copy-pasted across suites — create a leftover
PermissionGrouprow (nothing provisions grant-only templates any more), add a membership, drop the auto-mirroredGrant— into shared helpers, and adopts them everywhere.Stacks on #2450 (
feat/perm/teams-header-strip); lands after it.What changes
New helpers (
common/tests/utils.py)make_permission_group(*, organization, template_name)— the org'sPermissionGroup, created on demand (idempotent template + row).revoke_grants(user)— drop everyGrantfor the user: the grantless-org-member state.add_legacy_membership(user, *, group)— legacy membership without the Grant mirror (m2m-edge mirror dropped).make_legacy_only_holder(*, organization, template_name, user)— the composite: org membership + leftover group + no Grants.Adopted in
test_grant_authorizationsuites (each lost its inline template/group/mirror block);accounts/tests/test_roles.py— its local_add_legacy_membershipand_legacy_org_admin_groupcopies are gone;accounts/tests/test_role_manager_grants.py,accounts/tests/test_permission_group.py—make_permission_group;test_room_queries/test_bed_queries/test_reservation_queries—revoke_grants(self.operator)replaces the inlineGrant…delete().Test plan
accounts common reports teams shelters— 1310 passed;ruffclean.Summary by Sourcery
Centralize legacy permission and grantless-member test fixtures and adopt them across the affected test suites.
New Features:
Enhancements:
Tests: