Skip to content

Commit

Permalink
Add test for MembershipNotFound (#482)
Browse files Browse the repository at this point in the history
Signed-off-by: Adi Bhagavath <[email protected]>
  • Loading branch information
adi-a11y authored Jun 24, 2024
1 parent 9941ad0 commit 10d1753
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pallets/network-membership/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,30 @@ fn test_renew_membership_again_should_fail() {
assert_eq!(NetworkMembership::members_count(), 1);
});
}

#[test]
fn test_revoke_membership_with_wrong_account_id_should_fail() {
new_test_ext().execute_with(|| {
run_to_block(1);

assert!(NetworkMembership::is_member(&AccountId::new([11u8; 32])));

assert_ok!(NetworkMembership::nominate(
RawOrigin::Root.into(),
AccountId::new([13u8; 32]),
true
));

System::assert_has_event(RuntimeEvent::NetworkMembership(Event::MembershipAcquired {
member: AccountId::new([13u8; 32]),
}));

assert_eq!(NetworkMembership::members_count(), 2);

run_to_block(2);
assert_err!(
NetworkMembership::revoke(RawOrigin::Root.into(), AccountId::new([15u8; 32]),),
Error::<Test>::MembershipNotFound
);
});
}

0 comments on commit 10d1753

Please sign in to comment.