Use parameter_types instead of thread_local for test-setup (#12036)

* Edit to Assets. parameter_types

* fixes

* Test Fixes. WIP

* Edits to pallet-aura

* Camel Case

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Implementation of mutate fn

* update to pallet-aura

* Update to frame-system. Fixes

* Update to frame-support-test. CamelCases

* Updates to frame- contracts, offences, staking, bounties, child bounties

* Edit to mutate fn. Changes to frame-contracts. CamelCase pallet-aura

* Edits to frame-contracts & executive

* cargo +nightly fmt

* unused import removed

* unused import removed

* cargo +nightly fmt

* minor adjustment

* updates

* updates

* cargo +nightly fmt

* cargo +nightly fmt

* take fn implemented

* update

* update

* Fixes to CallFilter

* cargo +nightly fmt

* final fixes

* Default changed to $value

* Update frame/support/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Boluwatife Bakre
2022-09-08 11:46:25 +01:00
committed by GitHub
parent bec123a50f
commit 3ec4d13e9f
32 changed files with 378 additions and 402 deletions
@@ -375,7 +375,7 @@ impl<T: Config, D: AsRef<[u8]>> KeyOwnerProofSystem<(KeyTypeId, D)> for Pallet<T
pub(crate) mod tests {
use super::*;
use crate::mock::{
force_new_session, set_next_validators, Session, System, Test, NEXT_VALIDATORS,
force_new_session, set_next_validators, NextValidators, Session, System, Test,
};
use sp_runtime::{key_types::DUMMY, testing::UintAuthorityId};
@@ -389,9 +389,11 @@ pub(crate) mod tests {
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let keys: Vec<_> = NEXT_VALIDATORS.with(|l| {
l.borrow().iter().cloned().map(|i| (i, i, UintAuthorityId(i).into())).collect()
});
let keys: Vec<_> = NextValidators::get()
.iter()
.cloned()
.map(|i| (i, i, UintAuthorityId(i).into()))
.collect();
BasicExternalities::execute_with_storage(&mut t, || {
for (ref k, ..) in &keys {
frame_system::Pallet::<Test>::inc_providers(k);
@@ -141,7 +141,7 @@ mod tests {
use super::*;
use crate::{
historical::{onchain, Pallet},
mock::{force_new_session, set_next_validators, Session, System, Test, NEXT_VALIDATORS},
mock::{force_new_session, set_next_validators, NextValidators, Session, System, Test},
};
use codec::Encode;
@@ -163,9 +163,12 @@ mod tests {
.build_storage::<Test>()
.expect("Failed to create test externalities.");
let keys: Vec<_> = NEXT_VALIDATORS.with(|l| {
l.borrow().iter().cloned().map(|i| (i, i, UintAuthorityId(i).into())).collect()
});
let keys: Vec<_> = NextValidators::get()
.iter()
.cloned()
.map(|i| (i, i, UintAuthorityId(i).into()))
.collect();
BasicExternalities::execute_with_storage(&mut t, || {
for (ref k, ..) in &keys {
frame_system::Pallet::<Test>::inc_providers(k);