Struct TestContext

Source
pub struct TestContext<'a, C> { /* private fields */ }
๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
Expand description

Context used for testing. The type parameter C is used to determine whether this will be an init or receive context.

Implementationsยง

Sourceยง

impl<'a, C> TestContext<'a, C>

Source

pub fn push_policy(&mut self, value: OwnedPolicy) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Push a new sender policy to the context. When the first policy is pushed this will set the policy vector to โ€˜Someโ€™, even if it was undefined previously.

Source

pub fn empty_policies(&mut self) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Set the policies to be defined, but an empty list. Such a situation can not realistically happen on the chain, but we provide functionality for it in case smart contract writers wish to program defensively.

Source

pub fn set_parameter(&mut self, value: &'a [u8]) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
Source

pub fn metadata_mut(&mut self) -> &mut TestChainMeta

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Get a mutable reference to the chain meta data placeholder

Source

pub fn set_metadata_slot_time(&mut self, value: SlotTime) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Set the metadata block slot time

Sourceยง

impl<'a> TestContext<'a, TestInitOnlyData>

Source

pub fn empty() -> Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Create an TestInitContext where every field is unset, and getting any of the fields will result in fail!.

Source

pub fn set_init_origin(&mut self, value: AccountAddress) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Set init_origin in the TestInitContext

Sourceยง

impl<'a> TestContext<'a, TestReceiveOnlyData>

Source

pub fn empty() -> Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Create a TestReceiveContext where every field is unset, and getting any of the fields will result in fail!.

Source

pub fn set_invoker(&mut self, value: AccountAddress) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
Source

pub fn set_self_address(&mut self, value: ContractAddress) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
Source

pub fn set_sender(&mut self, value: Address) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
Source

pub fn set_owner(&mut self, value: AccountAddress) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
Source

pub fn set_named_entrypoint(&mut self, value: OwnedEntrypointName) -> &mut Self

๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.

Trait Implementationsยง

Sourceยง

impl<'a, C: Clone> Clone for TestContext<'a, C>

Sourceยง

fn clone(&self) -> TestContext<'a, C>

Returns a copy of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl<'a, C: Default> Default for TestContext<'a, C>

Sourceยง

fn default() -> TestContext<'a, C>

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl<'a, C> HasCommonData for TestContext<'a, C>

Sourceยง

type MetadataType = TestChainMeta

Sourceยง

type ParamType = TestParameterCursor<'a>

Sourceยง

type PolicyIteratorType = IntoIter<TestPolicy>

Sourceยง

type PolicyType = TestPolicy

Sourceยง

fn parameter_cursor(&self) -> Self::ParamType

Get the cursor to the parameter.
Sourceยง

fn metadata(&self) -> &Self::MetadataType

Get the reference to chain metadata
Sourceยง

fn policies(&self) -> Self::PolicyIteratorType

Policies of the sender of the message. For init methods this is the would-be creator of the contract, for the receive this is the policies of the immediate sender. Read more

Auto Trait Implementationsยง

ยง

impl<'a, C> Freeze for TestContext<'a, C>
where C: Freeze,

ยง

impl<'a, C> RefUnwindSafe for TestContext<'a, C>
where C: RefUnwindSafe,

ยง

impl<'a, C> !Send for TestContext<'a, C>

ยง

impl<'a, C> !Sync for TestContext<'a, C>

ยง

impl<'a, C> Unpin for TestContext<'a, C>
where C: Unpin,

ยง

impl<'a, C> UnwindSafe for TestContext<'a, C>
where C: UnwindSafe,

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.