Module testing

Source

Structs§

MockApi
Zero-pads all human addresses to make them fit the canonical_length and trims off zeros for the reverse operation. This is not really smart, but allows us to see a difference (and consistent length for canonical addresses).
MockInstanceOptions
MockQuerier
MockQuerier holds an immutable table of bank balances
MockStorage

Constants§

MOCK_CONTRACT_ADDR

Functions§

execute
instantiate
Mimics the call signature of the smart contracts. Thus it moves env and msg rather than take them as reference. This is inefficient here, but only used in test code.
migrate
migrate_with_info
mock_backend
All external requirements that can be injected for unit tests. It sets the given balance for the contract itself, nothing else
mock_backend_with_balances
Initializes the querier along with the mock_dependencies. Sets all balances provided (you must explicitly set contract balance if desired)
mock_env
Returns a default environment with height, time, chain_id, and contract address. You can submit as is to most contracts, or modify height/time if you want to test for expiration.
mock_info
Just set sender and funds for the message. This is intended for use in test code only.
mock_instance
mock_instance_options
Creates InstanceOptions for testing
mock_instance_with_balances
mock_instance_with_failing_api
mock_instance_with_gas_limit
Creates an instance from the given Wasm bytecode. The gas limit is measured in CosmWasm gas.
mock_instance_with_options
query
reply
sudo
test_io
Runs a series of IO tests, hammering especially on allocate and deallocate. This could be especially useful when run with some kind of leak detector.