test(role_store): cover revoke-side member-count and enumeration bookkeeping (#564) - #697
Open
trakshan-mishra wants to merge 1 commit into
Open
Conversation
…keeping The test module thoroughly exercises the grant side of role bookkeeping (test_role_member_enumeration, test_idempotent_grant) but never the revoke side: no test checks get_role_member_count after a revoke, no test checks get_role_members excludes the revoked account, and no test exercises idempotent revoke. Add three tests mirroring the grant-side coverage: - test_revoke_decrements_count_and_removes_from_members: grant a role to two accounts, revoke one, assert count decremented by exactly one and get_role_members contains the remaining account but not the revoked one. - test_revoke_from_multi_member_preserves_others: grant to three accounts, revoke the middle one, assert the other two are still present (catches vec_remove_addr removing the wrong entry from a multi-member list). - test_idempotent_revoke: revoke twice, assert the count does not go negative or decrement twice (mirror of test_idempotent_grant). cargo test -p role-store: 14 passed, 0 failed. Closes SO4-Markets#564
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.
Description
Closes #564 — adds revoke-side member-count/enumeration bookkeeping tests to
role_store.The test module thoroughly exercises the grant side (
test_role_member_enumerationchecks count/members after two grants;test_idempotent_grantchecks double-grant is a no-op) but never the revoke side:get_role_member_countafter a revokeget_role_membersexcludes the revoked accountvec_remove_addrremoves only the targetWhat changed
Added three tests mirroring the grant-side coverage:
test_revoke_decrements_count_and_removes_from_members— grant to two accounts, revoke one, assert count decremented by exactly one andget_role_memberscontains the remaining account but not the revoked one.test_revoke_from_multi_member_preserves_others— grant to three accounts, revoke the middle one, assert the other two are still present (catchesvec_remove_addrremoving the wrong entry from a multi-member list).test_idempotent_revoke— revoke twice, assert the count does not go negative or decrement twice (mirror oftest_idempotent_grant).Also adds a
vec_contains_addrtest helper (the existingvec_contains_b32only works forBytesN<32>, notAddress).Verification
Related issues
Closes #564