Skip to content

Add integration test: access-control role revocation edge cases #41

Description

@christabel888

Context: Hardening pass before the analytics pivot leans on these contracts more heavily for indexing.

Where:

  • access-control/src/test.rs -- access-control has no test file yet -- this issue includes creating access-control/src/test.rs

What to do:

  • Add test coverage for role revocation: a revoked role should immediately fail permission checks, including any cached/derived permissions.
  • Follow the existing test conventions used elsewhere in the workspace (e.g. escrow/src/test.rs, governance/src/test.rs) for env/contract setup boilerplate.

Suggested approach:

  1. Read access-control/src/lib.rs end to end first -- write down every state transition and every Result::Err path before writing a single test, so you're testing behavior you've actually verified exists, not behavior you assume exists.
  2. Cover the happy path first, then the specific edge case named in this issue, then at least one "should fail" case (wrong caller, wrong state, etc.).
  3. Use Soroban's test Env with Env::default() and mock auths (env.mock_all_auths() or targeted auth mocking) matching the pattern already used in sibling test files.
  4. Since access-control has no test file yet, set up access-control/src/test.rs from scratch -- copy the env/contract-registration boilerplate from a sibling crate's test file (e.g. escrow/src/test.rs) rather than reinventing it, and add mod test; to access-control/src/lib.rs.

Watch out for:

Definition of done:

  • New test(s) added covering the scenario above
  • cargo test -p access-control passes
  • Test also runs under the workspace-wide cargo test

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions