Questions tagged [mock]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

trait bound pallet::Config not satisfied even it is implemented

If more context is needed, it is available in commit b392cfa3, file mock.rs. I'm trying to add a mock for my pallet pallet_quotas in order to implement unit tests. My pallet depends on a certain ...
Hugo Trentesaux's user avatar
0 votes
1 answer
31 views

Multiple test mock runtimes with slightly different configs based off common base?

We have some custom pallet unit tests that use multiple mock runtimes that are configured slightly differently. The problem is that when we have to make changes to the runtime, we have to apply those ...
Robert La Ferla's user avatar
0 votes
1 answer
36 views

How is it possible to avoid a mock runtime and use the actual runtime for testing?

I would like to avoid the most pallet config initialisation and just want to use the actual runtime configuration for the (unit) tests. This would simplify my mock process a lot. The only thing that ...
Chralt's user avatar
  • 543
2 votes
1 answer
81 views

How to check is it mock runtime?

I have a function //for testing purposes only! pub fn some_fn(n: T::BlockNumber) { SomeStorage::<T>::set(n); } for testing purposes only! How to check is it a mock runtime? something like ...
rust.dev's user avatar
  • 509
1 vote
1 answer
84 views

How to mock XCM origin in tests?

My custom pallet has a couple of XCM calls, for which I have to provide the Origin in mock.rs. It implements the #[pallet::config] pub trait Config: frame_system::Config { ... ...
birbomakar's user avatar
0 votes
1 answer
43 views

the trait bound `mock::Test: pallet_rmrk_core::Config` is not satisfied

I'm writing a pallet, which depends on pallet-rmrk-core, based on pallet-template. In lib.rs I wrote: #[pallet::config] pub trait Config: frame_system::Config + pallet_rmrk_core::Config { ...
haggis's user avatar
  • 103
1 vote
1 answer
91 views

How to use an outer mock inside `impl_benchmark_test_suite`?

Hey valuable Substrate pros, do you know a way to use impl_benchmark_test_suite inside another crate like the runtime? I have multiple pallets. There are no mocks inside these pallets. There is only ...
Chralt's user avatar
  • 543
0 votes
1 answer
82 views

Building precompile mock results in error[E0277]: the trait bound `currencies::MultiCurrencyPrecompile<TestRuntime>: Precompile` is not satisfied

I am currently implementing a mock for our EVM precompiles but ran into the following error when building the tests error[E0277]: the trait bound `currencies::MultiCurrencyPrecompile<...
chexware's user avatar
  • 325
3 votes
2 answers
133 views

Testing transaction fee movements

I am attempting to build some tests that initiate and validate transaction fee movements. The problem is that I seem unable to initiate transaction fees in a mock runtime at all. I suspect I am ...
K. Lane's user avatar
  • 61
1 vote
1 answer
61 views

Recommended layout for testing integration of pallets

I've been working on a pallet in isolation for a few months. I did testing by mocking a runtime and mocking the related pallets that are expected by it. Basically, so far I have created fake pallets ...
Angelo's user avatar
  • 501
3 votes
0 answers
66 views

Ways to mock client + custom runtime api from client side

I have some code in a Substrate client that needs to call one of my runtime apis. I'd like an easy way to mock the client and custom runtime api functions to check that they're called. Is there an ...
Justin Frevert's user avatar
2 votes
2 answers
241 views

Benchmarking Mock

We’re trying to do the exact thing as referenced in How to mock trait in benchmarking, and we have implemented the struct + trait we need in our mocks, however, the benchmarks are calling the runtime ...
Yatusabes's user avatar
  • 766
2 votes
1 answer
19 views

Example of MockValidationDataInherentDataProvider usage​

Is there any example of how to use MockValidationDataInherentDataProvider to run a parachain with mock validation? I've been looking all over and can't seem to find any documentation or example of it'...
Gabe's user avatar
  • 115
1 vote
1 answer
51 views

Error facing while mocking runtime for unit testing

Here is the error I am seeing: type mismatch resolving <sp_core::sr25519::Public as IdentifyAccount>::AccountId == u64 --> pallets/src/mock.rs:76:2 | 76 | type Public = <Signature as ...
Immanuel John's user avatar
3 votes
1 answer
104 views

Mocking Polkadot requests in Jest

I'm building out some local unit tests and am trying to figure out how to mock Polkadot requests/responses. I'm trying to get mock-socket working, wondering if there is any documentation on using this ...
Michael Ramuta's user avatar
3 votes
1 answer
179 views

How to mock trait in benchmarking

Can you tell me how to mock a trait in benchmarking? We have a pallet which takes NFTTrait as one of the configs. See below. #[pallet::config] pub trait Config: frame_system::Config { ...
Jerry Ren's user avatar
2 votes
1 answer
131 views

testing pallet with ensure_root

I have written tests.rs and mock.rs everything is working except a function which has checks for root pub fn create_something( origin: OriginFor<T>, org: T::Hash ) -> ...
Boris Ivanov's user avatar