-
Notifications
You must be signed in to change notification settings - Fork 2.7k
add negative tests #11995
add negative tests #11995
Changes from 1 commit
e1e3aaf
d29042a
10729cd
6a8e399
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -441,9 +441,43 @@ fn retire_works() { | |
member: (3), | ||
unreserved: None, | ||
})); | ||
|
||
// Move time on: | ||
System::set_block_number(System::block_number() + RetirementPeriod::get()); | ||
|
||
assert_powerless(Origin::signed(3)); | ||
}); | ||
} | ||
|
||
fn assert_powerless(user: Origin) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
//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::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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gilescope |
||
|
||
// Currently failing below: | ||
assert_noop!(Alliance::add_unscrupulous_items(user.clone(), vec![]), BadOrigin); | ||
|
||
assert_noop!(Alliance::remove_unscrupulous_items(user.clone(), vec![]), BadOrigin); | ||
|
||
assert_noop!(Alliance::announce(user, cid.clone()), Error::<Test, ()>::NotAlly); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there three checked by |
||
} | ||
|
||
#[test] | ||
fn kick_member_works() { | ||
new_test_ext().execute_with(|| { | ||
|
There was a problem hiding this comment.
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