Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
juangirini committed Aug 28, 2023
1 parent 1295455 commit 1631ae4
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 27 deletions.
5 changes: 2 additions & 3 deletions polkadot/runtime/common/src/auctions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,9 +677,7 @@ mod tests {
use crate::{auctions, mock::TestRegistrar};
use ::test_helpers::{dummy_hash, dummy_head_data, dummy_validation_code};
use frame_support::{
assert_noop, assert_ok, assert_storage_noop,
dispatch::DispatchError::BadOrigin,
ord_parameter_types, parameter_types,
assert_noop, assert_ok, assert_storage_noop, ord_parameter_types, parameter_types,
traits::{ConstU32, EitherOfDiverse, OnFinalize, OnInitialize},
};
use frame_system::{EnsureRoot, EnsureSignedBy};
Expand All @@ -689,6 +687,7 @@ mod tests {
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
DispatchError::BadOrigin,
};
use std::{cell::RefCell, collections::BTreeMap};

Expand Down
6 changes: 4 additions & 2 deletions polkadot/runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,15 +711,17 @@ mod tests {
use claims::Call as ClaimsCall;
use frame_support::{
assert_err, assert_noop, assert_ok,
dispatch::{DispatchError::BadOrigin, GetDispatchInfo, Pays},
dispatch::{GetDispatchInfo, Pays},
ord_parameter_types, parameter_types,
traits::{ConstU32, ExistenceRequirement, WithdrawReasons},
};
use pallet_balances;
use sp_runtime::{
traits::{BlakeTwo256, Identity, IdentityLookup},
transaction_validity::TransactionLongevity,
BuildStorage, TokenError,
BuildStorage,
DispatchError::BadOrigin,
TokenError,
};

type Block = frame_system::mocking::MockBlock<Test>;
Expand Down
7 changes: 2 additions & 5 deletions polkadot/runtime/common/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
//! Mocking utilities for testing.

use crate::traits::Registrar;
use frame_support::{
dispatch::{DispatchError, DispatchResult},
weights::Weight,
};
use frame_support::{dispatch::DispatchResult, weights::Weight};
use frame_system::pallet_prelude::BlockNumberFor;
use parity_scale_codec::{Decode, Encode};
use primitives::{HeadData, Id as ParaId, PvfCheckStatement, SessionIndex, ValidationCode};
use runtime_parachains::paras;
use sp_keyring::Sr25519Keyring;
use sp_runtime::{traits::SaturatedConversion, Permill};
use sp_runtime::{traits::SaturatedConversion, DispatchError, Permill};
use std::{cell::RefCell, collections::HashMap};

thread_local! {
Expand Down
8 changes: 4 additions & 4 deletions polkadot/runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,14 +484,14 @@ mod tests {
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are required.
use crate::purchase;
use frame_support::{
assert_noop, assert_ok,
dispatch::DispatchError::BadOrigin,
ord_parameter_types, parameter_types,
assert_noop, assert_ok, ord_parameter_types, parameter_types,
traits::{Currency, WithdrawReasons},
};
use sp_runtime::{
traits::{BlakeTwo256, Dispatchable, IdentifyAccount, Identity, IdentityLookup, Verify},
ArithmeticError, BuildStorage, MultiSignature,
ArithmeticError, BuildStorage,
DispatchError::BadOrigin,
MultiSignature,
};

type Block = frame_system::mocking::MockBlock<Test>;
Expand Down
5 changes: 2 additions & 3 deletions polkadot/xcm/xcm-builder/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ pub use crate::{
use frame_support::traits::{ContainsPair, Everything};
pub use frame_support::{
dispatch::{
DispatchError, DispatchInfo, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
Parameter, PostDispatchInfo,
DispatchInfo, DispatchResultWithPostInfo, GetDispatchInfo, Parameter, PostDispatchInfo,
},
ensure, match_types, parameter_types,
sp_runtime::DispatchErrorWithPostInfo,
sp_runtime::{traits::Dispatchable, DispatchError, DispatchErrorWithPostInfo},
traits::{ConstU32, Contains, Get, IsInVec},
};
pub use parity_scale_codec::{Decode, Encode};
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/safe-mode/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
use super::*;
use crate::mock::{RuntimeCall, *};

use frame_support::{assert_err, assert_noop, assert_ok, dispatch::Dispatchable, traits::Currency};
use sp_runtime::TransactionOutcome;
use frame_support::{assert_err, assert_noop, assert_ok, traits::Currency};
use sp_runtime::{traits::Dispatchable, TransactionOutcome};

/// Do something hypothetically by rolling back any changes afterwards.
///
Expand Down
8 changes: 3 additions & 5 deletions substrate/frame/support/test/tests/pallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@

use frame_support::{
assert_ok,
dispatch::{
DispatchClass, DispatchInfo, Dispatchable, GetDispatchInfo, Parameter, Pays,
UnfilteredDispatchable,
},
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Parameter, Pays},
dispatch_context::with_context,
pallet_prelude::{StorageInfoTrait, ValueQuery},
parameter_types,
storage::unhashed,
traits::{
ConstU32, GetCallIndex, GetCallName, GetStorageVersion, OnFinalize, OnGenesis,
OnInitialize, OnRuntimeUpgrade, PalletError, PalletInfoAccess, StorageVersion,
UnfilteredDispatchable,
},
weights::{RuntimeDbWeight, Weight},
};
Expand All @@ -37,7 +35,7 @@ use sp_io::{
TestExternalities,
};
use sp_runtime::{
traits::{Extrinsic as ExtrinsicT, SignaturePayload as SignaturePayloadT},
traits::{Dispatchable, Extrinsic as ExtrinsicT, SignaturePayload as SignaturePayloadT},
DispatchError, ModuleError,
};

Expand Down
7 changes: 5 additions & 2 deletions substrate/frame/support/test/tests/pallet_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
// limitations under the License.

use frame_support::{
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays, UnfilteredDispatchable},
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays},
pallet_prelude::ValueQuery,
parameter_types,
storage::unhashed,
traits::{ConstU32, GetCallName, OnFinalize, OnGenesis, OnInitialize, OnRuntimeUpgrade},
traits::{
ConstU32, GetCallName, OnFinalize, OnGenesis, OnInitialize, OnRuntimeUpgrade,
UnfilteredDispatchable,
},
weights::Weight,
};
use sp_io::{
Expand Down
3 changes: 2 additions & 1 deletion substrate/frame/tx-pause/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
use super::*;
use crate::mock::{RuntimeCall, *};

use frame_support::{assert_err, assert_noop, assert_ok, dispatch::Dispatchable};
use frame_support::{assert_err, assert_noop, assert_ok};
use sp_runtime::DispatchError;

// GENERAL SUCCESS/POSITIVE TESTS ---------------------

Expand Down

0 comments on commit 1631ae4

Please sign in to comment.