Use construct_runtime in tests, remove default PalletInfo impl (#2409)

* Claims

* Crowdloan

* Runtime common

* Parachains registrar

* Impls

* Purchase

* Slots

* parachains runtime mock

* Use MockGenesisConfig in tests

* Update runtime/common/src/claims.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
Andrew Jones
2021-02-09 16:36:15 +00:00
committed by GitHub
parent 6981a1c366
commit 7343c974a2
16 changed files with 186 additions and 229 deletions
+22 -19
View File
@@ -944,21 +944,29 @@ mod tests {
use sp_core::H256;
use sp_runtime::traits::{BlakeTwo256, Hash, IdentityLookup};
use frame_support::{
impl_outer_origin, parameter_types, assert_ok, assert_noop,
parameter_types, assert_ok, assert_noop,
traits::{OnInitialize, OnFinalize}
};
use pallet_balances;
use primitives::v1::{BlockNumber, Header, Id as ParaId};
use crate::slots;
impl_outer_origin! {
pub enum Origin for Test {}
}
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
Slots: slots::{Module, Call, Storage, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
}
);
// For testing the module, we construct most of a mock runtime. This means
// first constructing a configuration type (`Test`) which `impl`s each of the
// configuration traits of modules we want to use.
#[derive(Clone, Eq, PartialEq)]
pub struct Test;
parameter_types! {
pub const BlockHashCount: u32 = 250;
}
@@ -968,7 +976,7 @@ mod tests {
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = ();
type Call = Call;
type Index = u64;
type BlockNumber = BlockNumber;
type Hash = H256;
@@ -976,10 +984,10 @@ mod tests {
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 = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -993,7 +1001,7 @@ mod tests {
impl pallet_balances::Config for Test {
type Balance = u64;
type Event = ();
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
@@ -1066,7 +1074,7 @@ mod tests {
}
impl Config for Test {
type Event = ();
type Event = Event;
type Currency = Balances;
type Parachains = TestParachains;
type LeasePeriod = LeasePeriod;
@@ -1074,11 +1082,6 @@ mod tests {
type Randomness = RandomnessCollectiveFlip;
}
type System = frame_system::Module<Test>;
type Balances = pallet_balances::Module<Test>;
type Slots = Module<Test>;
type RandomnessCollectiveFlip = pallet_randomness_collective_flip::Module<Test>;
// This function basically just builds a genesis storage key/value store according to
// our desired mock up.
fn new_test_ext() -> sp_io::TestExternalities {