mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 00:31:07 +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:
@@ -414,8 +414,7 @@ mod tests {
|
||||
use super::*;
|
||||
use primitives::H256;
|
||||
use sr_primitives::{
|
||||
set_and_run_with_externalities, traits::{BlakeTwo256, IdentityLookup}, testing::Header,
|
||||
generic::DigestItem, Perbill,
|
||||
traits::{BlakeTwo256, IdentityLookup}, testing::Header, generic::DigestItem, Perbill,
|
||||
};
|
||||
use support::{parameter_types, impl_outer_origin, ConsensusEngineId};
|
||||
|
||||
@@ -542,7 +541,7 @@ mod tests {
|
||||
#[test]
|
||||
fn prune_old_uncles_works() {
|
||||
use UncleEntryItem::*;
|
||||
set_and_run_with_externalities(&mut new_test_ext(), || {
|
||||
new_test_ext().execute_with(|| {
|
||||
let hash = Default::default();
|
||||
let author = Default::default();
|
||||
let uncles = vec![
|
||||
@@ -561,7 +560,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn rejects_bad_uncles() {
|
||||
set_and_run_with_externalities(&mut new_test_ext(), || {
|
||||
new_test_ext().execute_with(|| {
|
||||
let author_a = 69;
|
||||
|
||||
struct CanonChain {
|
||||
@@ -674,7 +673,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn sets_author_lazily() {
|
||||
set_and_run_with_externalities(&mut new_test_ext(), || {
|
||||
new_test_ext().execute_with(|| {
|
||||
let author = 42;
|
||||
let mut header = seal_header(
|
||||
create_header(1, Default::default(), [1; 32].into()),
|
||||
|
||||
Reference in New Issue
Block a user