Use construct_runtime in tests (#8059)

* impl some more

* add serde

* remove unused

* fix staking fuzz

* fix system bench

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Guillaume Thiolliere
2021-02-06 21:12:46 +01:00
committed by GitHub
parent 4b1460f61f
commit 0ed683ca13
18 changed files with 446 additions and 445 deletions
+21 -17
View File
@@ -15,23 +15,29 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::*;
use crate::{self as pallet_example_parallel, *};
use codec::{Encode, Decode};
use frame_support::{impl_outer_origin, parameter_types};
use frame_support::parameter_types;
use sp_core::H256;
use sp_runtime::{
Perbill,
testing::{Header},
Perbill, testing::Header,
traits::{BlakeTwo256, IdentityLookup},
};
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>;
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Example: pallet_example_parallel::{Module, Call, Storage, Event},
}
);
#[derive(Clone, Eq, PartialEq, Encode, Decode)]
pub struct Test;
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const AvailableBlockRatio: Perbill = Perbill::one();
@@ -40,8 +46,8 @@ parameter_types! {
impl frame_system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = ();
type PalletInfo = ();
type Call = Call;
type PalletInfo = PalletInfo;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -49,7 +55,7 @@ impl frame_system::Config for Test {
type AccountId = sp_core::sr25519::Public;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = ();
type Event = Event;
type BlockHashCount = BlockHashCount;
type DbWeight = ();
type BlockWeights = ();
@@ -69,12 +75,10 @@ parameter_types! {
}
impl Config for Test {
type Event = ();
type Call = Call<Test>;
type Event = Event;
type Call = Call;
}
type Example = Module<Test>;
#[test]
fn it_can_enlist() {
use sp_core::Pair;