mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +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:
@@ -65,10 +65,7 @@ mod tests {
|
||||
|
||||
use support::{assert_ok, assert_noop, impl_outer_origin, parameter_types, impl_outer_dispatch};
|
||||
use primitives::H256;
|
||||
use sr_primitives::{
|
||||
Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header,
|
||||
set_and_run_with_externalities,
|
||||
};
|
||||
use sr_primitives::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header};
|
||||
|
||||
impl_outer_origin! {
|
||||
pub enum Origin for Test {}
|
||||
@@ -150,7 +147,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn batch_works() {
|
||||
set_and_run_with_externalities(&mut new_test_ext(), || {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_eq!(Balances::free_balance(1), 10);
|
||||
assert_eq!(Balances::free_balance(2), 0);
|
||||
assert_noop!(Utility::batch(Origin::signed(1), vec![
|
||||
|
||||
Reference in New Issue
Block a user