From 266768bb90918aab25723ac70ddd93310b378cee Mon Sep 17 00:00:00 2001
From: wangjj9219 <183318287@qq.com>
Date: Thu, 18 Feb 2021 16:32:29 +0800
Subject: [PATCH] use mock structs (#376)

---
 auction/src/mock.rs          | 4 ++--
 authority/src/mock.rs        | 6 +++---
 currencies/src/mock.rs       | 7 +++----
 gradually-update/src/mock.rs | 4 ++--
 nft/src/mock.rs              | 5 ++---
 oracle/src/mock.rs           | 7 +++----
 rewards/src/mock.rs          | 5 ++---
 tokens/src/mock.rs           | 6 +++---
 vesting/src/mock.rs          | 9 +++------
 9 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/auction/src/mock.rs b/auction/src/mock.rs
index ca866d6..ab409e6 100644
--- a/auction/src/mock.rs
+++ b/auction/src/mock.rs
@@ -77,8 +77,8 @@ impl Config for Runtime {
 	type WeightInfo = ();
 }
 
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
+type Block = frame_system::mocking::MockBlock<Runtime>;
 
 construct_runtime!(
 	pub enum Runtime where
diff --git a/authority/src/mock.rs b/authority/src/mock.rs
index 2549a66..a3f6fa0 100644
--- a/authority/src/mock.rs
+++ b/authority/src/mock.rs
@@ -153,8 +153,8 @@ impl Config for Runtime {
 	type WeightInfo = ();
 }
 
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64, u64, ()>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
+type Block = frame_system::mocking::MockBlock<Runtime>;
 
 frame_support::construct_runtime!(
 	pub enum Runtime where
@@ -162,7 +162,7 @@ frame_support::construct_runtime!(
 		NodeBlock = Block,
 		UncheckedExtrinsic = UncheckedExtrinsic
 	{
-		System: frame_system::{Module, Call, Event<T>},
+		System: frame_system::{Module, Call, Config, Event<T>},
 		Authority: authority::{Module, Call, Origin<T>, Event<T>},
 		Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>},
 	}
diff --git a/currencies/src/mock.rs b/currencies/src/mock.rs
index 364060d..97f3b40 100644
--- a/currencies/src/mock.rs
+++ b/currencies/src/mock.rs
@@ -3,7 +3,7 @@
 #![cfg(test)]
 
 use super::*;
-use frame_support::{construct_runtime, parameter_types, traits::GenesisBuild};
+use frame_support::{construct_runtime, parameter_types};
 use orml_traits::parameter_type_with_key;
 use sp_core::H256;
 use sp_runtime::{
@@ -98,8 +98,8 @@ impl Config for Runtime {
 pub type NativeCurrency = NativeCurrencyOf<Runtime>;
 pub type AdaptedBasicCurrency = BasicCurrencyAdapter<Runtime, PalletBalances, i64, u64>;
 
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
+type Block = frame_system::mocking::MockBlock<Runtime>;
 
 construct_runtime!(
 	pub enum Runtime where
@@ -111,7 +111,6 @@ construct_runtime!(
 		Currencies: currencies::{Module, Call, Event<T>},
 		Tokens: orml_tokens::{Module, Storage, Event<T>, Config<T>},
 		PalletBalances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
-
 	}
 );
 
diff --git a/gradually-update/src/mock.rs b/gradually-update/src/mock.rs
index a3440eb..9814925 100644
--- a/gradually-update/src/mock.rs
+++ b/gradually-update/src/mock.rs
@@ -52,8 +52,8 @@ impl Config for Runtime {
 	type WeightInfo = ();
 }
 
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
+type Block = frame_system::mocking::MockBlock<Runtime>;
 
 construct_runtime!(
 	pub enum Runtime where
diff --git a/nft/src/mock.rs b/nft/src/mock.rs
index 31180ff..a8d1dae 100644
--- a/nft/src/mock.rs
+++ b/nft/src/mock.rs
@@ -49,8 +49,8 @@ impl Config for Runtime {
 	type TokenData = ();
 }
 
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
+type Block = frame_system::mocking::MockBlock<Runtime>;
 
 construct_runtime!(
 	pub enum Runtime where
@@ -60,7 +60,6 @@ construct_runtime!(
 	{
 		System: frame_system::{Module, Call, Storage, Config, Event<T>},
 		NonFungibleTokenModule: nft::{Module, Storage, Config<T>},
-
 	}
 );
 
diff --git a/oracle/src/mock.rs b/oracle/src/mock.rs
index d1564d0..b0173ac 100644
--- a/oracle/src/mock.rs
+++ b/oracle/src/mock.rs
@@ -2,7 +2,7 @@
 
 use super::*;
 
-use frame_support::{construct_runtime, parameter_types, traits::GenesisBuild};
+use frame_support::{construct_runtime, parameter_types};
 use sp_core::H256;
 use sp_runtime::{
 	testing::Header,
@@ -83,8 +83,8 @@ impl Config for Test {
 	type WeightInfo = ();
 }
 
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
+type Block = frame_system::mocking::MockBlock<Test>;
 
 construct_runtime!(
 	pub enum Test where
@@ -94,7 +94,6 @@ construct_runtime!(
 	{
 		System: frame_system::{Module, Call, Storage, Config, Event<T>},
 		ModuleOracle: oracle::{Module, Storage, Call, Config<T>, Event<T>},
-
 	}
 );
 
diff --git a/rewards/src/mock.rs b/rewards/src/mock.rs
index f4bc36b..5838f30 100644
--- a/rewards/src/mock.rs
+++ b/rewards/src/mock.rs
@@ -109,8 +109,8 @@ impl Config for Runtime {
 	type WeightInfo = ();
 }
 
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
+type Block = frame_system::mocking::MockBlock<Runtime>;
 
 construct_runtime!(
 	pub enum Runtime where
@@ -120,7 +120,6 @@ construct_runtime!(
 	{
 		System: frame_system::{Module, Call, Storage, Config, Event<T>},
 		RewardsModule: rewards::{Module, Storage, Call},
-
 	}
 );
 
diff --git a/tokens/src/mock.rs b/tokens/src/mock.rs
index d1bc52d..a46a046 100644
--- a/tokens/src/mock.rs
+++ b/tokens/src/mock.rs
@@ -5,7 +5,7 @@
 use super::*;
 use frame_support::{
 	construct_runtime, parameter_types,
-	traits::{ChangeMembers, Contains, ContainsLengthBound, GenesisBuild, SaturatingCurrencyToVote},
+	traits::{ChangeMembers, Contains, ContainsLengthBound, SaturatingCurrencyToVote},
 };
 use orml_traits::parameter_type_with_key;
 use sp_core::H256;
@@ -217,8 +217,8 @@ impl Config for Runtime {
 }
 pub type TreasuryCurrencyAdapter = <Runtime as pallet_treasury::Config>::Currency;
 
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
+type Block = frame_system::mocking::MockBlock<Runtime>;
 
 construct_runtime!(
 	pub enum Runtime where
diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs
index 22910aa..7274ef9 100644
--- a/vesting/src/mock.rs
+++ b/vesting/src/mock.rs
@@ -3,10 +3,7 @@
 #![cfg(test)]
 
 use super::*;
-use frame_support::{
-	construct_runtime, parameter_types,
-	traits::{EnsureOrigin, GenesisBuild},
-};
+use frame_support::{construct_runtime, parameter_types, traits::EnsureOrigin};
 use frame_system::RawOrigin;
 use sp_core::H256;
 use sp_runtime::{testing::Header, traits::IdentityLookup};
@@ -86,8 +83,8 @@ impl Config for Runtime {
 	type WeightInfo = ();
 }
 
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u32, ()>;
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
+type Block = frame_system::mocking::MockBlock<Runtime>;
 
 construct_runtime!(
 	pub enum Runtime where
-- 
GitLab