From 7a438471193740b92e50779c38aa8badfc000285 Mon Sep 17 00:00:00 2001 From: librelois <c@elo.tf> Date: Mon, 13 Jun 2022 18:04:52 +0200 Subject: [PATCH] tests(runtime): use assert_noop instead of assert_err --- pallets/authority-members/src/tests.rs | 4 ++-- pallets/duniter-wot/src/tests.rs | 8 ++++---- pallets/identity/src/tests.rs | 2 +- runtime/gdev/tests/integration_tests.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pallets/authority-members/src/tests.rs b/pallets/authority-members/src/tests.rs index d11b98b45..0c9ac2971 100644 --- a/pallets/authority-members/src/tests.rs +++ b/pallets/authority-members/src/tests.rs @@ -17,7 +17,7 @@ use super::*; use crate::mock::*; use crate::MemberData; -use frame_support::{assert_err, assert_ok}; +use frame_support::{assert_noop, assert_ok}; use sp_runtime::testing::UintAuthorityId; const EMPTY: Vec<u64> = Vec::new(); @@ -249,7 +249,7 @@ fn test_too_many_authorities() { UintAuthorityId(15).into(), )); assert_eq!(AuthorityMembers::authorities_counter(), 4); - assert_err!( + assert_noop!( AuthorityMembers::go_online(Origin::signed(15)), Error::<Test>::TooManyAuthorities, ); diff --git a/pallets/duniter-wot/src/tests.rs b/pallets/duniter-wot/src/tests.rs index 7bff9e19f..5081c4073 100644 --- a/pallets/duniter-wot/src/tests.rs +++ b/pallets/duniter-wot/src/tests.rs @@ -16,7 +16,7 @@ use crate::mock::Identity; use crate::mock::*; -use frame_support::assert_err; +use frame_support::assert_noop; use frame_support::assert_ok; use frame_support::instances::Instance1; use frame_system::{EventRecord, Phase}; @@ -43,7 +43,7 @@ fn test_creator_not_allowed_to_create_idty() { // Alice should not be able to create an identity before block #2 // because Alice.next_issuable_on = 2 - assert_err!( + assert_noop!( Identity::create_identity(Origin::signed(1), 4), pallet_identity::Error::<Test>::CreatorNotAllowedToCreateIdty ); @@ -81,7 +81,7 @@ fn test_revoke_smiths_them_rejoin() { // Dave should not be able to re-request membership before the RevocationPeriod end run_to_block(3); - assert_err!( + assert_noop!( SmithsMembership::request_membership(Origin::signed(4), crate::MembershipMetaData(4)), pallet_membership::Error::<Test, crate::Instance2>::MembershipRevokedRecently ); @@ -281,7 +281,7 @@ fn test_idty_membership_expire_them_requested() { assert!(Identity::identity(3).is_none()); // Alice can't renew her cert to Charlie - assert_err!( + assert_noop!( Cert::add_cert(Origin::signed(1), 3), pallet_certification::Error::<Test, Instance1>::ReceiverNotFound ); diff --git a/pallets/identity/src/tests.rs b/pallets/identity/src/tests.rs index d33b3001c..3a25afc57 100644 --- a/pallets/identity/src/tests.rs +++ b/pallets/identity/src/tests.rs @@ -17,7 +17,7 @@ use crate::mock::*; use crate::{Error, GenesisIdty, IdtyName, IdtyValue, RevocationPayload}; use codec::Encode; -//use frame_support::assert_err; +//use frame_support::assert_noop; use frame_support::assert_ok; use frame_system::{EventRecord, Phase}; use sp_runtime::testing::TestSignature; diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index 9f67f73a2..9647ceb01 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -18,7 +18,7 @@ mod common; use common::*; 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 gdev_runtime::*; use sp_keyring::AccountKeyring; @@ -295,7 +295,7 @@ fn test_create_new_account() { // We can't remove the account until the random id is assigned run_to_block(4); - assert_err!( + assert_noop!( Balances::transfer( frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), MultiAddress::Id(AccountKeyring::Alice.to_account_id()), -- GitLab