Skip to content

Commit 702ceb4

Browse files
committed
fix tests
1 parent a0ffb6a commit 702ceb4

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

pallets/utility/src/tests.rs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,27 @@ parameter_types! {
177177
pub MaxProposalWeight: Weight = sp_runtime::Perbill::from_percent(50) * BlockWeights::get().max_block;
178178
}
179179

180+
pub struct MemberProposals;
181+
impl pallet_collective::CanPropose<u64> for MemberProposals {
182+
fn can_propose(who: &u64) -> bool {
183+
[1, 2, 3].contains(who)
184+
}
185+
}
186+
187+
pub struct MemberVotes;
188+
impl pallet_collective::CanVote<u64> for MemberVotes {
189+
fn can_vote(who: &u64) -> bool {
190+
[1, 2, 3].contains(who)
191+
}
192+
}
193+
194+
pub struct StoredVotingMembers;
195+
impl pallet_collective::GetVotingMembers<u32> for StoredVotingMembers {
196+
fn get_count() -> u32 {
197+
3
198+
}
199+
}
200+
180201
type CouncilCollective = pallet_collective::Instance1;
181202
impl pallet_collective::Config<CouncilCollective> for Test {
182203
type RuntimeOrigin = RuntimeOrigin;
@@ -188,9 +209,9 @@ impl pallet_collective::Config<CouncilCollective> for Test {
188209
type DefaultVote = pallet_collective::PrimeDefaultVote;
189210
type WeightInfo = ();
190211
type SetMembersOrigin = frame_system::EnsureRoot<Self::AccountId>;
191-
type CanPropose = ();
192-
type CanVote = ();
193-
type GetVotingMembers = ();
212+
type CanPropose = MemberProposals;
213+
type CanVote = MemberVotes;
214+
type GetVotingMembers = StoredVotingMembers;
194215
}
195216

196217
impl example::Config for Test {}
@@ -818,8 +839,9 @@ fn batch_works_with_council_origin() {
818839
assert_ok!(Council::vote(RuntimeOrigin::signed(3), hash, 0, true));
819840

820841
System::set_block_number(4);
842+
821843
assert_ok!(Council::close(
822-
RuntimeOrigin::signed(3),
844+
RuntimeOrigin::root(),
823845
hash,
824846
0,
825847
proposal_weight,
@@ -856,7 +878,7 @@ fn force_batch_works_with_council_origin() {
856878

857879
System::set_block_number(4);
858880
assert_ok!(Council::close(
859-
RuntimeOrigin::signed(3),
881+
RuntimeOrigin::root(),
860882
hash,
861883
0,
862884
proposal_weight,

0 commit comments

Comments
 (0)