Description 📝
Create a test suite to verify the end-to-end integration between the central Shade contract and the Merchant Account contract during the restriction process. This confirms that roles are correctly enforced at the entry point and state changes propagate across contracts.
Proposed Steps 📝
- Test Setup:
- Create
contracts/shade/src/tests/test_shade_restriction.rs.
- Deploy the Shade contract and register a merchant to deploy their account contract.
- Implement Test Cases:
- Admin Command:
- Call
restrict_merchant_account(true) as the Shade Admin.
- Verify the Merchant Account contract's
is_restricted_account() now returns true.
- Verify Shade event emission.
- Manager Command:
- Call
restrict_merchant_account(false) as a Shade Manager.
- Verify the Merchant Account contract status updates correctly.
- Unauthorized Attempt:
- Attempt to trigger restriction from a random account or the merchant themselves through the Shade contract.
- Expect Shade-level
NotAuthorized or role check panic.
- Invalid Merchant:
- Attempt to restrict an account for an address that is not registered as a merchant.
- Verify appropriate error/panic (e.g.,
MerchantNotFound).
Acceptance Criteria ✅
- Tests confirm cross-contract state synchronization.
- Access control at the Shade level is strictly verified.
- Integration is proven to handle success and failure cases gracefully.
Description 📝
Create a test suite to verify the end-to-end integration between the central Shade contract and the Merchant Account contract during the restriction process. This confirms that roles are correctly enforced at the entry point and state changes propagate across contracts.
Proposed Steps 📝
contracts/shade/src/tests/test_shade_restriction.rs.restrict_merchant_account(true)as the Shade Admin.is_restricted_account()now returnstrue.restrict_merchant_account(false)as a Shade Manager.NotAuthorizedor role check panic.MerchantNotFound).Acceptance Criteria ✅