test(energy_token): add access control tests for unauthorized mint (#278)#1
Open
devSoniia wants to merge 1 commit into
Open
test(energy_token): add access control tests for unauthorized mint (#278)#1devSoniia wants to merge 1 commit into
devSoniia wants to merge 1 commit into
Conversation
…d set_minter Closes AnnabelJoe#278 - test_mint_unauthorized_caller_panics: verifies mint() panics when called without minter auth (no mock_all_auths) - test_mint_succeeds_with_minter_auth: verifies authorized minter can mint - test_set_minter_unauthorized_caller_panics: verifies set_minter() panics without admin auth The minter role, set_minter(), and require_auth() were already implemented; these tests provide coverage for the unauthorized-caller acceptance criteria.
🔍 Vercel Preview DeploymentURL: Learn More: https://err.sh/vercel/no-credentials-found
|
✅ cargo audit |
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
Closes AnnabelJoe#278
The
energy_tokencontract already enforces minter access control viaminter.require_auth()inmint()andadmin.require_auth()inset_minter(). This PR adds unit tests that verify unauthorized callers are rejected.Changes
test_mint_unauthorized_caller_panics— callsmint()without mocking minter auth; expects host auth failure panictest_mint_succeeds_with_minter_auth— callsmint()with explicit mintermock_auths; verifies balance updatedtest_set_minter_unauthorized_caller_panics— callsset_minter()without admin auth; expects panicTesting