pub struct StandaloneCanisterFixture { /* private fields */ }Expand description
StandaloneCanisterFixture
Implementations§
Source§impl StandaloneCanisterFixture
impl StandaloneCanisterFixture
Sourcepub fn install(pocket_ic: PocketIc, spec: InstallSpec) -> Self
pub fn install(pocket_ic: PocketIc, spec: InstallSpec) -> Self
Install one canister into a caller-configured PocketIC instance.
Sourcepub fn try_install(
pocket_ic: PocketIc,
spec: InstallSpec,
) -> Result<Self, StandaloneCanisterInstallError>
pub fn try_install( pocket_ic: PocketIc, spec: InstallSpec, ) -> Result<Self, StandaloneCanisterInstallError>
Fallible counterpart to install.
On failure, the error retains both the caller’s PocketIC instance and the structured install failure.
Sourcepub const fn pocket_ic(&self) -> &PocketIc
pub const fn pocket_ic(&self) -> &PocketIc
Borrow the PocketIC instance that owns this standalone fixture.
Sourcepub const fn canister_id(&self) -> Principal
pub const fn canister_id(&self) -> Principal
Read the installed canister id for this standalone fixture.
Sourcepub fn into_parts(self) -> (PocketIc, Principal)
pub fn into_parts(self) -> (PocketIc, Principal)
Consume the fixture and return the owned PocketIC instance and canister id.
Sourcepub fn update_call<T, A>(
&self,
method: &str,
args: A,
) -> Result<T, CandidCallError>
pub fn update_call<T, A>( &self, method: &str, args: A, ) -> Result<T, CandidCallError>
Forward one typed update call to this fixture’s canister id.
Sourcepub fn update_call_or_panic<T, A>(&self, method: &str, args: A) -> T
pub fn update_call_or_panic<T, A>(&self, method: &str, args: A) -> T
Forward one typed update call to this fixture’s canister id, panicking on rejection or Candid codec failure.
This does not unwrap application-level results. For example,
update_call_or_panic::<Result<T, E>, _>(...) returns Result<T, E>.
Sourcepub fn update_call_as<T, A>(
&self,
caller: Principal,
method: &str,
args: A,
) -> Result<T, CandidCallError>
pub fn update_call_as<T, A>( &self, caller: Principal, method: &str, args: A, ) -> Result<T, CandidCallError>
Forward one typed update call with an explicit caller to this fixture’s canister id.
Sourcepub fn update_call_as_or_panic<T, A>(
&self,
caller: Principal,
method: &str,
args: A,
) -> T
pub fn update_call_as_or_panic<T, A>( &self, caller: Principal, method: &str, args: A, ) -> T
Forward one typed update call with an explicit caller to this fixture’s canister id, panicking on rejection or Candid codec failure.
This does not unwrap application-level results. For example,
update_call_as_or_panic::<Result<T, E>, _>(...) returns Result<T, E>.
Sourcepub fn query_call<T, A>(
&self,
method: &str,
args: A,
) -> Result<T, CandidCallError>
pub fn query_call<T, A>( &self, method: &str, args: A, ) -> Result<T, CandidCallError>
Forward one typed query call to this fixture’s canister id.
Sourcepub fn query_call_or_panic<T, A>(&self, method: &str, args: A) -> T
pub fn query_call_or_panic<T, A>(&self, method: &str, args: A) -> T
Forward one typed query call to this fixture’s canister id, panicking on rejection or Candid codec failure.
This does not unwrap application-level results. For example,
query_call_or_panic::<Result<T, E>, _>(...) returns Result<T, E>.
Sourcepub fn query_call_as<T, A>(
&self,
caller: Principal,
method: &str,
args: A,
) -> Result<T, CandidCallError>
pub fn query_call_as<T, A>( &self, caller: Principal, method: &str, args: A, ) -> Result<T, CandidCallError>
Forward one typed query call with an explicit caller to this fixture’s canister id.
Sourcepub fn query_call_as_or_panic<T, A>(
&self,
caller: Principal,
method: &str,
args: A,
) -> T
pub fn query_call_as_or_panic<T, A>( &self, caller: Principal, method: &str, args: A, ) -> T
Forward one typed query call with an explicit caller to this fixture’s canister id, panicking on rejection or Candid codec failure.
This does not unwrap application-level results. For example,
query_call_as_or_panic::<Result<T, E>, _>(...) returns Result<T, E>.