mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 03:31:10 +00:00
Add execute_with to TestExternalities (#3793)
This function executes the given closure in a context where the test externalities are set. This makes the srml tests easier to write, as the test externalities need to be created anyway.
This commit is contained in:
@@ -340,8 +340,8 @@ impl ExtBuilder {
|
||||
keys: validators.iter().map(|x| (*x, UintAuthorityId(*x))).collect(),
|
||||
}.assimilate_storage(&mut storage);
|
||||
|
||||
let mut ext = storage.into();
|
||||
sr_primitives::set_and_run_with_externalities(&mut ext, || {
|
||||
let mut ext = runtime_io::TestExternalities::from(storage);
|
||||
ext.execute_with(|| {
|
||||
let validators = Session::validators();
|
||||
SESSION.with(|x|
|
||||
*x.borrow_mut() = (validators.clone(), HashSet::new())
|
||||
|
||||
+440
-496
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user