Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions frame/alliance/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,36 @@ fn retire_works() {
member: (3),
unreserved: None,
}));

// Move time on:
System::set_block_number(System::block_number() + RetirementPeriod::get());

assert_powerless(Origin::signed(3));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are using 3, not 4

});
}

fn assert_powerless(user: Origin) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

I think right not it make sense to check if method supposed to be executed by a member.
For add_unscrupulous_items for example, its not really a case, because its checked by AnnouncementOrigin provided by client of pallet.

If you think it should be different (should check if the caller is a member for example), I think we need a different issue for it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise in this context we are not really checking than the retirement made the use powerless, but more that announcement functionality is allowed only for AnnouncementOrigin

//vote / veto with a valid propsal
let cid = test_cid();
let proposal = make_proposal(42);

assert_noop!(Alliance::init_members(user.clone(), vec![], vec![], vec![]), BadOrigin);

assert_noop!(Alliance::set_rule(user.clone(), cid.clone()), BadOrigin);

assert_noop!(Alliance::retire(user.clone()), Error::<Test, ()>::RetirementNoticeNotGiven);

assert_noop!(Alliance::give_retirement_notice(user.clone()), Error::<Test, ()>::NotMember);

assert_noop!(Alliance::elevate_ally(user.clone(), 4), BadOrigin);

assert_noop!(Alliance::kick_member(user.clone(), 1), BadOrigin);

assert_noop!(Alliance::nominate_ally(user.clone(), 4), Error::<Test, ()>::NoVotingRights);

assert_noop!(Alliance::propose(user.clone(), 5, Box::new(proposal), 1000), Error::<Test, ()>::NoVotingRights);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gilescope
the last one user.clone() could be just user

}

#[test]
fn kick_member_works() {
new_test_ext().execute_with(|| {
Expand Down