Repository navigation
test: add admin transfer, upgrade and credential display unit tests (#539, #540, #541) - #679
Merged
DeFiVC merged 2 commits intoOct 21, 2026
Conversation
… and display coverage Restores the workspace test suite that broke on the RBAC/typed-error changes and adds the missing coverage for issues ChainLearnOfficial#539, ChainLearnOfficial#540 and ChainLearnOfficial#541: - ChainLearnOfficial#539 admin handover: pending candidate overwrite, admin signature enforcement, pending-admin acceptance, handover delay and minimum delay - ChainLearnOfficial#540 contract upgrade: admin auth, role holder rejection, version and wasm hash updates, event emission and failed-upgrade invariants - ChainLearnOfficial#541 credential display: field set/get, partial updates, overwrite, admin auth, unknown credential, per-credential scoping and revocation Also fixes the pre-existing breakage in the test suite (stale panic expectations replaced with typed error assertions, outdated pause and mint_credential call sites, storage-size expectations and duplicated course creation).
This was referenced Oct 21, 2026
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.
Closes #539
Closes #540
Closes #541
Summary
Closes the three remaining issues from the #538-#541 test batch and repairs the test suite that was left broken by the RBAC/typed-error work in #677 and the test merge in #678.
#539 — Admin transfer / handover
test_double_transfer_overwrites_previous_pending— a secondtransfer_adminreplaces the pending candidatetest_transfer_admin_requires_the_current_admin_signature— only the current admin can nominate a successortest_pending_admin_alone_can_accept_the_handover— the pending admin can accept without the old admintest_default_admin_transfer_delay_blocks_acceptance_within_48_hours— the default 48h delay is enforcedtest_admin_transfer_delay_is_never_below_the_minimum— the minimum delay cannot be lowered#540 — Contract upgrade
test_upgrade_requires_admin_auth— only the admin can upgradetest_upgrade_rejects_non_admin_role_holder— a role holder without the admin role is rejectedtest_upgrade_sets_wasm_hash_and_increments_version— the hash is stored and the version incrementstest_upgrade_emits_upgraded_event— the upgrade event is emitted with the new versiontest_failed_upgrade_leaves_version_and_hash_untouched— a failed upgrade changes nothing#541 — Credential display
test_get_credential_display_returns_none_for_unset/..._for_unknown_credentialtest_set_credential_display_all_fields/..._partial_fields/..._updates_overwrites_previous_valuestest_set_credential_display_emits_eventtest_set_credential_display_requires_admin_auth— no admin auth means no writetest_set_credential_display_rejects_unknown_credential— typedContractError::NotFoundtest_set_credential_display_is_scoped_to_a_single_credentialtest_set_credential_display_survives_revocationTest-suite repairs (pre-existing breakage)
mint_credentialcall sites updated to the post-RBAC signatureshould_panicexpectations replaced with typed error assertionspause/unpause/emergency_pausecall sites correctedcreate_coursecalls removed from the cross-contract teststest_get_certificate_uri_uses_the_cert_prefix_formatnow really asserts thecert_+ lowercase hex formatTesting
cargo test --workspace— 829 passed, 0 failed