2021-02-24 14:12:24 +00:00
|
|
|
use crate as pallet_template;
|
2022-02-24 18:09:06 +00:00
|
|
|
use frame_support::traits::{ConstU16, ConstU64};
|
2021-07-20 12:44:58 +00:00
|
|
|
use frame_system as system;
|
|
|
|
use sp_core::H256;
|
2020-03-05 16:53:25 +00:00
|
|
|
use sp_runtime::{
|
2021-07-20 12:44:58 +00:00
|
|
|
testing::Header,
|
|
|
|
traits::{BlakeTwo256, IdentityLookup},
|
2020-03-05 16:53:25 +00:00
|
|
|
};
|
|
|
|
|
2021-02-24 14:12:24 +00:00
|
|
|
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
|
|
|
type Block = frame_system::mocking::MockBlock<Test>;
|
2020-03-05 16:53:25 +00:00
|
|
|
|
2020-07-25 12:35:30 +00:00
|
|
|
// Configure a mock runtime to test the pallet.
|
2021-02-24 14:12:24 +00:00
|
|
|
frame_support::construct_runtime!(
|
|
|
|
pub enum Test where
|
|
|
|
Block = Block,
|
|
|
|
NodeBlock = Block,
|
|
|
|
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
|
|
{
|
2022-08-19 18:57:12 +00:00
|
|
|
System: frame_system,
|
|
|
|
TemplateModule: pallet_template,
|
2021-02-24 14:12:24 +00:00
|
|
|
}
|
|
|
|
);
|
2020-07-25 12:35:30 +00:00
|
|
|
|
2021-02-24 14:12:24 +00:00
|
|
|
impl system::Config for Test {
|
2021-09-07 15:26:25 +00:00
|
|
|
type BaseCallFilter = frame_support::traits::Everything;
|
2021-02-24 14:12:24 +00:00
|
|
|
type BlockWeights = ();
|
|
|
|
type BlockLength = ();
|
|
|
|
type DbWeight = ();
|
2020-03-05 16:53:25 +00:00
|
|
|
type Origin = Origin;
|
2021-02-24 14:12:24 +00:00
|
|
|
type Call = Call;
|
2020-03-05 16:53:25 +00:00
|
|
|
type Index = u64;
|
|
|
|
type BlockNumber = u64;
|
|
|
|
type Hash = H256;
|
|
|
|
type Hashing = BlakeTwo256;
|
|
|
|
type AccountId = u64;
|
|
|
|
type Lookup = IdentityLookup<Self::AccountId>;
|
|
|
|
type Header = Header;
|
2021-02-24 14:12:24 +00:00
|
|
|
type Event = Event;
|
2022-02-24 18:09:06 +00:00
|
|
|
type BlockHashCount = ConstU64<250>;
|
2020-03-05 16:53:25 +00:00
|
|
|
type Version = ();
|
2021-02-24 14:12:24 +00:00
|
|
|
type PalletInfo = PalletInfo;
|
2020-03-05 16:53:25 +00:00
|
|
|
type AccountData = ();
|
|
|
|
type OnNewAccount = ();
|
|
|
|
type OnKilledAccount = ();
|
2020-07-25 12:35:30 +00:00
|
|
|
type SystemWeightInfo = ();
|
2022-02-24 18:09:06 +00:00
|
|
|
type SS58Prefix = ConstU16<42>;
|
2021-05-19 06:45:16 +00:00
|
|
|
type OnSetCode = ();
|
2022-02-24 18:09:06 +00:00
|
|
|
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
2020-03-05 16:53:25 +00:00
|
|
|
}
|
2020-07-25 12:35:30 +00:00
|
|
|
|
2021-02-24 14:12:24 +00:00
|
|
|
impl pallet_template::Config for Test {
|
|
|
|
type Event = Event;
|
2020-03-05 16:53:25 +00:00
|
|
|
}
|
2020-07-25 12:35:30 +00:00
|
|
|
|
|
|
|
// Build genesis storage according to the mock runtime.
|
2020-03-05 16:53:25 +00:00
|
|
|
pub fn new_test_ext() -> sp_io::TestExternalities {
|
|
|
|
system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
|
|
|
}
|