Skip to content
Snippets Groups Projects
Commit 7a438471 authored by Éloïs's avatar Éloïs
Browse files

tests(runtime): use assert_noop instead of assert_err

parent 2f97bbaf
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
use super::*; use super::*;
use crate::mock::*; use crate::mock::*;
use crate::MemberData; use crate::MemberData;
use frame_support::{assert_err, assert_ok}; use frame_support::{assert_noop, assert_ok};
use sp_runtime::testing::UintAuthorityId; use sp_runtime::testing::UintAuthorityId;
const EMPTY: Vec<u64> = Vec::new(); const EMPTY: Vec<u64> = Vec::new();
...@@ -249,7 +249,7 @@ fn test_too_many_authorities() { ...@@ -249,7 +249,7 @@ fn test_too_many_authorities() {
UintAuthorityId(15).into(), UintAuthorityId(15).into(),
)); ));
assert_eq!(AuthorityMembers::authorities_counter(), 4); assert_eq!(AuthorityMembers::authorities_counter(), 4);
assert_err!( assert_noop!(
AuthorityMembers::go_online(Origin::signed(15)), AuthorityMembers::go_online(Origin::signed(15)),
Error::<Test>::TooManyAuthorities, Error::<Test>::TooManyAuthorities,
); );
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
use crate::mock::Identity; use crate::mock::Identity;
use crate::mock::*; use crate::mock::*;
use frame_support::assert_err; use frame_support::assert_noop;
use frame_support::assert_ok; use frame_support::assert_ok;
use frame_support::instances::Instance1; use frame_support::instances::Instance1;
use frame_system::{EventRecord, Phase}; use frame_system::{EventRecord, Phase};
...@@ -43,7 +43,7 @@ fn test_creator_not_allowed_to_create_idty() { ...@@ -43,7 +43,7 @@ fn test_creator_not_allowed_to_create_idty() {
// Alice should not be able to create an identity before block #2 // Alice should not be able to create an identity before block #2
// because Alice.next_issuable_on = 2 // because Alice.next_issuable_on = 2
assert_err!( assert_noop!(
Identity::create_identity(Origin::signed(1), 4), Identity::create_identity(Origin::signed(1), 4),
pallet_identity::Error::<Test>::CreatorNotAllowedToCreateIdty pallet_identity::Error::<Test>::CreatorNotAllowedToCreateIdty
); );
...@@ -81,7 +81,7 @@ fn test_revoke_smiths_them_rejoin() { ...@@ -81,7 +81,7 @@ fn test_revoke_smiths_them_rejoin() {
// Dave should not be able to re-request membership before the RevocationPeriod end // Dave should not be able to re-request membership before the RevocationPeriod end
run_to_block(3); run_to_block(3);
assert_err!( assert_noop!(
SmithsMembership::request_membership(Origin::signed(4), crate::MembershipMetaData(4)), SmithsMembership::request_membership(Origin::signed(4), crate::MembershipMetaData(4)),
pallet_membership::Error::<Test, crate::Instance2>::MembershipRevokedRecently pallet_membership::Error::<Test, crate::Instance2>::MembershipRevokedRecently
); );
...@@ -281,7 +281,7 @@ fn test_idty_membership_expire_them_requested() { ...@@ -281,7 +281,7 @@ fn test_idty_membership_expire_them_requested() {
assert!(Identity::identity(3).is_none()); assert!(Identity::identity(3).is_none());
// Alice can't renew her cert to Charlie // Alice can't renew her cert to Charlie
assert_err!( assert_noop!(
Cert::add_cert(Origin::signed(1), 3), Cert::add_cert(Origin::signed(1), 3),
pallet_certification::Error::<Test, Instance1>::ReceiverNotFound pallet_certification::Error::<Test, Instance1>::ReceiverNotFound
); );
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
use crate::mock::*; use crate::mock::*;
use crate::{Error, GenesisIdty, IdtyName, IdtyValue, RevocationPayload}; use crate::{Error, GenesisIdty, IdtyName, IdtyValue, RevocationPayload};
use codec::Encode; use codec::Encode;
//use frame_support::assert_err; //use frame_support::assert_noop;
use frame_support::assert_ok; use frame_support::assert_ok;
use frame_system::{EventRecord, Phase}; use frame_system::{EventRecord, Phase};
use sp_runtime::testing::TestSignature; use sp_runtime::testing::TestSignature;
......
...@@ -18,7 +18,7 @@ mod common; ...@@ -18,7 +18,7 @@ mod common;
use common::*; use common::*;
use frame_support::traits::{PalletInfo, StorageInfo, StorageInfoTrait}; use frame_support::traits::{PalletInfo, StorageInfo, StorageInfoTrait};
use frame_support::{assert_err, assert_ok}; use frame_support::{assert_noop, assert_ok};
use frame_support::{StorageHasher, Twox128}; use frame_support::{StorageHasher, Twox128};
use gdev_runtime::*; use gdev_runtime::*;
use sp_keyring::AccountKeyring; use sp_keyring::AccountKeyring;
...@@ -295,7 +295,7 @@ fn test_create_new_account() { ...@@ -295,7 +295,7 @@ fn test_create_new_account() {
// We can't remove the account until the random id is assigned // We can't remove the account until the random id is assigned
run_to_block(4); run_to_block(4);
assert_err!( assert_noop!(
Balances::transfer( Balances::transfer(
frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(),
MultiAddress::Id(AccountKeyring::Alice.to_account_id()), MultiAddress::Id(AccountKeyring::Alice.to_account_id()),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment