mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 06:11:07 +00:00
Removed pallet::getter usage from pallet-collective (#3456)
Part of #3326 This one is easier as all the storage items are public. @ggwpez @kianenigma @shawntabrizi --------- Signed-off-by: Matteo Muraca <mmuraca247@gmail.com> Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> Co-authored-by: command-bot <> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -193,8 +193,8 @@ fn default_max_proposal_weight() -> Weight {
|
||||
#[test]
|
||||
fn motions_basic_environment_works() {
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
assert_eq!(Collective::members(), vec![1, 2, 3]);
|
||||
assert_eq!(*Collective::proposals(), Vec::<H256>::new());
|
||||
assert_eq!(Members::<Test, Instance1>::get(), vec![1, 2, 3]);
|
||||
assert_eq!(*Proposals::<Test, Instance1>::get(), Vec::<H256>::new());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ fn initialize_members_sorts_members() {
|
||||
ExtBuilder::default()
|
||||
.set_collective_members(unsorted_members)
|
||||
.build_and_execute(|| {
|
||||
assert_eq!(Collective::members(), expected_members);
|
||||
assert_eq!(Members::<Test, Instance1>::get(), expected_members);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -219,8 +219,8 @@ fn set_members_with_prime_works() {
|
||||
Some(3),
|
||||
MaxMembers::get()
|
||||
));
|
||||
assert_eq!(Collective::members(), members.clone());
|
||||
assert_eq!(Collective::prime(), Some(3));
|
||||
assert_eq!(Members::<Test, Instance1>::get(), members.clone());
|
||||
assert_eq!(Prime::<Test, Instance1>::get(), Some(3));
|
||||
assert_noop!(
|
||||
Collective::set_members(RuntimeOrigin::root(), members, Some(4), MaxMembers::get()),
|
||||
Error::<Test, Instance1>::PrimeAccountNotMember
|
||||
@@ -632,12 +632,12 @@ fn removal_of_old_voters_votes_works() {
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(1), hash, 0, true));
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 0, true));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 0, threshold: 3, ayes: vec![1, 2], nays: vec![], end })
|
||||
);
|
||||
Collective::change_members_sorted(&[4], &[1], &[2, 3, 4]);
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 0, threshold: 3, ayes: vec![2], nays: vec![], end })
|
||||
);
|
||||
|
||||
@@ -653,12 +653,12 @@ fn removal_of_old_voters_votes_works() {
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 1, true));
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(3), hash, 1, false));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 1, threshold: 2, ayes: vec![2], nays: vec![3], end })
|
||||
);
|
||||
Collective::change_members_sorted(&[], &[3], &[2, 4]);
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 1, threshold: 2, ayes: vec![2], nays: vec![], end })
|
||||
);
|
||||
});
|
||||
@@ -680,7 +680,7 @@ fn removal_of_old_voters_votes_works_with_set_members() {
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(1), hash, 0, true));
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 0, true));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 0, threshold: 3, ayes: vec![1, 2], nays: vec![], end })
|
||||
);
|
||||
assert_ok!(Collective::set_members(
|
||||
@@ -690,7 +690,7 @@ fn removal_of_old_voters_votes_works_with_set_members() {
|
||||
MaxMembers::get()
|
||||
));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 0, threshold: 3, ayes: vec![2], nays: vec![], end })
|
||||
);
|
||||
|
||||
@@ -706,7 +706,7 @@ fn removal_of_old_voters_votes_works_with_set_members() {
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 1, true));
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(3), hash, 1, false));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 1, threshold: 2, ayes: vec![2], nays: vec![3], end })
|
||||
);
|
||||
assert_ok!(Collective::set_members(
|
||||
@@ -716,7 +716,7 @@ fn removal_of_old_voters_votes_works_with_set_members() {
|
||||
MaxMembers::get()
|
||||
));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 1, threshold: 2, ayes: vec![2], nays: vec![], end })
|
||||
);
|
||||
});
|
||||
@@ -735,10 +735,10 @@ fn propose_works() {
|
||||
Box::new(proposal.clone()),
|
||||
proposal_len
|
||||
));
|
||||
assert_eq!(*Collective::proposals(), vec![hash]);
|
||||
assert_eq!(Collective::proposal_of(&hash), Some(proposal));
|
||||
assert_eq!(*Proposals::<Test, Instance1>::get(), vec![hash]);
|
||||
assert_eq!(ProposalOf::<Test, Instance1>::get(&hash), Some(proposal));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 0, threshold: 3, ayes: vec![], nays: vec![], end })
|
||||
);
|
||||
|
||||
@@ -898,13 +898,13 @@ fn motions_vote_after_works() {
|
||||
));
|
||||
// Initially there a no votes when the motion is proposed.
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 0, threshold: 2, ayes: vec![], nays: vec![], end })
|
||||
);
|
||||
// Cast first aye vote.
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(1), hash, 0, true));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 0, threshold: 2, ayes: vec![1], nays: vec![], end })
|
||||
);
|
||||
// Try to cast a duplicate aye vote.
|
||||
@@ -915,7 +915,7 @@ fn motions_vote_after_works() {
|
||||
// Cast a nay vote.
|
||||
assert_ok!(Collective::vote(RuntimeOrigin::signed(1), hash, 0, false));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 0, threshold: 2, ayes: vec![], nays: vec![1], end })
|
||||
);
|
||||
// Try to cast a duplicate nay vote.
|
||||
@@ -966,7 +966,7 @@ fn motions_all_first_vote_free_works() {
|
||||
proposal_len,
|
||||
));
|
||||
assert_eq!(
|
||||
Collective::voting(&hash),
|
||||
Voting::<Test, Instance1>::get(&hash),
|
||||
Some(Votes { index: 0, threshold: 2, ayes: vec![], nays: vec![], end })
|
||||
);
|
||||
|
||||
@@ -1031,14 +1031,14 @@ fn motions_reproposing_disapproved_works() {
|
||||
proposal_weight,
|
||||
proposal_len
|
||||
));
|
||||
assert_eq!(*Collective::proposals(), vec![]);
|
||||
assert_eq!(*Proposals::<Test, Instance1>::get(), vec![]);
|
||||
assert_ok!(Collective::propose(
|
||||
RuntimeOrigin::signed(1),
|
||||
2,
|
||||
Box::new(proposal.clone()),
|
||||
proposal_len
|
||||
));
|
||||
assert_eq!(*Collective::proposals(), vec![hash]);
|
||||
assert_eq!(*Proposals::<Test, Instance1>::get(), vec![hash]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user