Adds state machine tests for the following scenarios:
Set the key for a provider that uses RpcAuth::BearerToken.
Update a previously existing API key of some provider to None removes it.
Panic if trying to specify an API key for a provider that uses RpcAccess::Unauthenticated
Panic if a provider is not found.
Sets up the following canister upgrade tests:
Keep previously inserted API keys.
Change or keep demo status based on upgrade args.
Change or keep principals allowed to manage API key providers based on upgrade args.
Includes unit tests for BoolStorable and PrincipalStorable.
Removes unused StringStorable.
Changes the requestCost canister method to return 0 when in demo mode.
Fixes the following bugs:
BoolStorable had an inverted condition in from_bytes
getProviderCost() returned Nat instead of Result<Nat, RpcError> in the state machine test logic
Note that the canister upgrade tests use the same Wasm before and after upgrade. In the future (probably out of scope of this PR), we could extend this to test upgrading from the most recently deployed canister's Wasm file.
Follow-up testing and bugfixes for #252.
This PR...
RpcAuth::BearerToken
.None
removes it.RpcAccess::Unauthenticated
BoolStorable
andPrincipalStorable
.StringStorable
.requestCost
canister method to return0
when in demo mode.BoolStorable
had an inverted condition infrom_bytes
getProviderCost()
returnedNat
instead ofResult<Nat, RpcError>
in the state machine test logicNote that the canister upgrade tests use the same Wasm before and after upgrade. In the future (probably out of scope of this PR), we could extend this to test upgrading from the most recently deployed canister's Wasm file.