mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
move some pallet test to use construct_runtime (#8049)
* migrate some more pallets * revert example-offcahin-worker as not straightforward * fix mmr
This commit is contained in:
committed by
GitHub
parent
6dea5494f3
commit
86498a1a0c
@@ -431,21 +431,28 @@ impl<T: Config> Module<T> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate as pallet_node_authorization;
|
||||
|
||||
use frame_support::{
|
||||
assert_ok, assert_noop, impl_outer_origin,
|
||||
parameter_types, ord_parameter_types,
|
||||
};
|
||||
use frame_support::{assert_ok, assert_noop, parameter_types, ord_parameter_types};
|
||||
use frame_system::EnsureSignedBy;
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup, BadOrigin}, testing::Header};
|
||||
|
||||
impl_outer_origin! {
|
||||
pub enum Origin for Test where system = frame_system {}
|
||||
}
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct Test;
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Test where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||
NodeAuthorization: pallet_node_authorization::{
|
||||
Module, Call, Storage, Config<T>, Event<T>,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
@@ -459,15 +466,15 @@ mod tests {
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
type Call = ();
|
||||
type Call = Call;
|
||||
type Hashing = BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = ();
|
||||
type Event = Event;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type Version = ();
|
||||
type PalletInfo = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
type AccountData = ();
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
@@ -486,7 +493,7 @@ mod tests {
|
||||
pub const MaxPeerIdLength: u32 = 2;
|
||||
}
|
||||
impl Config for Test {
|
||||
type Event = ();
|
||||
type Event = Event;
|
||||
type MaxWellKnownNodes = MaxWellKnownNodes;
|
||||
type MaxPeerIdLength = MaxPeerIdLength;
|
||||
type AddOrigin = EnsureSignedBy<One, u64>;
|
||||
@@ -496,15 +503,13 @@ mod tests {
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
type NodeAuthorization = Module<Test>;
|
||||
|
||||
fn test_node(id: u8) -> PeerId {
|
||||
PeerId(vec![id])
|
||||
}
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
GenesisConfig::<Test> {
|
||||
pallet_node_authorization::GenesisConfig::<Test> {
|
||||
nodes: vec![(test_node(10), 10), (test_node(20), 20), (test_node(30), 30)],
|
||||
}.assimilate_storage(&mut t).unwrap();
|
||||
t.into()
|
||||
|
||||
Reference in New Issue
Block a user