Newer
Older
//! Mocks for the gradually-update module.
#![cfg(test)]
use frame_support::{construct_runtime, parameter_types};
use sp_runtime::{testing::Header, traits::IdentityLookup};
parameter_types! {
pub const BlockHashCount: u64 = 250;
}
type Origin = Origin;
type Index = u64;
type BlockNumber = BlockNumber;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type BlockWeights = ();
type BlockLength = ();
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
}
parameter_types! {
pub const UpdateFrequency: BlockNumber = 10;
pub MaxGraduallyUpdate: u32 = 3;
pub MaxStorageKeyBytes: u32 = 100_000;
pub MaxStorageValueBytes: u32 = 100_000;
type DispatchOrigin = frame_system::EnsureRoot<AccountId>;
type MaxGraduallyUpdate = MaxGraduallyUpdate;
type MaxStorageKeyBytes = MaxStorageKeyBytes;
type MaxStorageValueBytes = MaxStorageValueBytes;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;
construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
GraduallyUpdateModule: gradually_update::{Pallet, Storage, Call, Event<T>},
pub struct ExtBuilder;
impl Default for ExtBuilder {
fn default() -> Self {
ExtBuilder
}
}
impl ExtBuilder {
pub fn build(self) -> sp_io::TestExternalities {
let t = frame_system::GenesisConfig::default()
.build_storage::<Runtime>()
.unwrap();
t.into()
}
}