|
@@ -1,4 +1,4 @@
|
|
-use super::mock::{Balances, Bureaucracy1, Membership, System, Test, TestEvent};
|
|
|
|
|
|
+use super::mock::{Balances, Membership, System, Test, TestEvent, WorkingGroup1};
|
|
use crate::types::{
|
|
use crate::types::{
|
|
OpeningPolicyCommitment, RewardPolicy, Worker, WorkerApplication, WorkerOpening,
|
|
OpeningPolicyCommitment, RewardPolicy, Worker, WorkerApplication, WorkerOpening,
|
|
WorkerRoleStakeProfile,
|
|
WorkerRoleStakeProfile,
|
|
@@ -39,7 +39,7 @@ impl IncreaseWorkerStakeFixture {
|
|
let stake_id = 0;
|
|
let stake_id = 0;
|
|
let old_stake = <stake::Module<Test>>::stakes(stake_id);
|
|
let old_stake = <stake::Module<Test>>::stakes(stake_id);
|
|
let old_balance = Balances::free_balance(&self.account_id);
|
|
let old_balance = Balances::free_balance(&self.account_id);
|
|
- let actual_result = Bureaucracy1::increase_worker_stake(
|
|
|
|
|
|
+ let actual_result = WorkingGroup1::increase_worker_stake(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.worker_id,
|
|
self.worker_id,
|
|
self.balance,
|
|
self.balance,
|
|
@@ -94,7 +94,7 @@ impl TerminateWorkerRoleFixture {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
<crate::WorkerExitRationaleText<Instance1>>::put(self.constraint.clone());
|
|
<crate::WorkerExitRationaleText<Instance1>>::put(self.constraint.clone());
|
|
|
|
|
|
- let actual_result = Bureaucracy1::terminate_worker_role(
|
|
|
|
|
|
+ let actual_result = WorkingGroup1::terminate_worker_role(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.worker_id,
|
|
self.worker_id,
|
|
self.text.clone(),
|
|
self.text.clone(),
|
|
@@ -129,7 +129,7 @@ impl LeaveWorkerRoleFixture {
|
|
|
|
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
let rationale_text = b"rationale_text".to_vec();
|
|
let rationale_text = b"rationale_text".to_vec();
|
|
- let actual_result = Bureaucracy1::leave_worker_role(
|
|
|
|
|
|
+ let actual_result = WorkingGroup1::leave_worker_role(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.worker_id,
|
|
self.worker_id,
|
|
rationale_text.clone(),
|
|
rationale_text.clone(),
|
|
@@ -164,7 +164,7 @@ impl UpdateWorkerRewardAccountFixture {
|
|
|
|
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
assert_eq!(
|
|
assert_eq!(
|
|
- Bureaucracy1::update_worker_reward_account(
|
|
|
|
|
|
+ WorkingGroup1::update_worker_reward_account(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.worker_id,
|
|
self.worker_id,
|
|
self.new_role_account_id
|
|
self.new_role_account_id
|
|
@@ -193,7 +193,7 @@ impl UpdateWorkerRoleAccountFixture {
|
|
}
|
|
}
|
|
|
|
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
- let actual_result = Bureaucracy1::update_worker_role_account(
|
|
|
|
|
|
+ let actual_result = WorkingGroup1::update_worker_role_account(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.worker_id,
|
|
self.worker_id,
|
|
self.new_role_account_id,
|
|
self.new_role_account_id,
|
|
@@ -201,7 +201,7 @@ impl UpdateWorkerRoleAccountFixture {
|
|
assert_eq!(actual_result, expected_result);
|
|
assert_eq!(actual_result, expected_result);
|
|
|
|
|
|
if actual_result.is_ok() {
|
|
if actual_result.is_ok() {
|
|
- let worker = Bureaucracy1::worker_by_id(self.worker_id);
|
|
|
|
|
|
+ let worker = WorkingGroup1::worker_by_id(self.worker_id);
|
|
|
|
|
|
assert_eq!(worker.role_account, self.new_role_account_id);
|
|
assert_eq!(worker.role_account, self.new_role_account_id);
|
|
}
|
|
}
|
|
@@ -211,11 +211,11 @@ impl UpdateWorkerRoleAccountFixture {
|
|
pub struct UnsetLeadFixture;
|
|
pub struct UnsetLeadFixture;
|
|
impl UnsetLeadFixture {
|
|
impl UnsetLeadFixture {
|
|
pub fn unset_lead() {
|
|
pub fn unset_lead() {
|
|
- assert_eq!(Bureaucracy1::unset_lead(RawOrigin::Root.into()), Ok(()));
|
|
|
|
|
|
+ assert_eq!(WorkingGroup1::unset_lead(RawOrigin::Root.into()), Ok(()));
|
|
}
|
|
}
|
|
|
|
|
|
pub fn call_and_assert(origin: RawOrigin<u64>, expected_result: Result<(), Error>) {
|
|
pub fn call_and_assert(origin: RawOrigin<u64>, expected_result: Result<(), Error>) {
|
|
- assert_eq!(Bureaucracy1::unset_lead(origin.into()), expected_result);
|
|
|
|
|
|
+ assert_eq!(WorkingGroup1::unset_lead(origin.into()), expected_result);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -260,8 +260,8 @@ impl FillWorkerOpeningFixture {
|
|
}
|
|
}
|
|
|
|
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) -> u64 {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) -> u64 {
|
|
- let saved_worker_next_id = Bureaucracy1::next_worker_id();
|
|
|
|
- let actual_result = Bureaucracy1::fill_worker_opening(
|
|
|
|
|
|
+ let saved_worker_next_id = WorkingGroup1::next_worker_id();
|
|
|
|
+ let actual_result = WorkingGroup1::fill_worker_opening(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.opening_id,
|
|
self.opening_id,
|
|
self.successful_worker_application_ids.clone(),
|
|
self.successful_worker_application_ids.clone(),
|
|
@@ -270,10 +270,10 @@ impl FillWorkerOpeningFixture {
|
|
assert_eq!(actual_result.clone(), expected_result);
|
|
assert_eq!(actual_result.clone(), expected_result);
|
|
|
|
|
|
if actual_result.is_ok() {
|
|
if actual_result.is_ok() {
|
|
- assert_eq!(Bureaucracy1::next_worker_id(), saved_worker_next_id + 1);
|
|
|
|
|
|
+ assert_eq!(WorkingGroup1::next_worker_id(), saved_worker_next_id + 1);
|
|
let worker_id = saved_worker_next_id;
|
|
let worker_id = saved_worker_next_id;
|
|
|
|
|
|
- let opening = Bureaucracy1::worker_opening_by_id(self.opening_id);
|
|
|
|
|
|
+ let opening = WorkingGroup1::worker_opening_by_id(self.opening_id);
|
|
|
|
|
|
let role_stake_profile = if opening
|
|
let role_stake_profile = if opening
|
|
.policy_commitment
|
|
.policy_commitment
|
|
@@ -303,7 +303,7 @@ impl FillWorkerOpeningFixture {
|
|
role_stake_profile,
|
|
role_stake_profile,
|
|
};
|
|
};
|
|
|
|
|
|
- let actual_worker = Bureaucracy1::worker_by_id(worker_id);
|
|
|
|
|
|
+ let actual_worker = WorkingGroup1::worker_by_id(worker_id);
|
|
|
|
|
|
assert_eq!(actual_worker, expected_worker);
|
|
assert_eq!(actual_worker, expected_worker);
|
|
}
|
|
}
|
|
@@ -328,7 +328,7 @@ impl BeginReviewWorkerApplicationsFixture {
|
|
BeginReviewWorkerApplicationsFixture { origin, ..self }
|
|
BeginReviewWorkerApplicationsFixture { origin, ..self }
|
|
}
|
|
}
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
- let actual_result = Bureaucracy1::begin_worker_applicant_review(
|
|
|
|
|
|
+ let actual_result = WorkingGroup1::begin_worker_applicant_review(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.opening_id,
|
|
self.opening_id,
|
|
);
|
|
);
|
|
@@ -358,7 +358,7 @@ impl TerminateApplicationFixture {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
- let actual_result = Bureaucracy1::terminate_worker_application(
|
|
|
|
|
|
+ let actual_result = WorkingGroup1::terminate_worker_application(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.worker_application_id,
|
|
self.worker_application_id,
|
|
);
|
|
);
|
|
@@ -387,7 +387,7 @@ impl WithdrawApplicationFixture {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
- let actual_result = Bureaucracy1::withdraw_worker_application(
|
|
|
|
|
|
+ let actual_result = WorkingGroup1::withdraw_worker_application(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.worker_application_id,
|
|
self.worker_application_id,
|
|
);
|
|
);
|
|
@@ -465,8 +465,8 @@ impl ApplyOnWorkerOpeningFixture {
|
|
}
|
|
}
|
|
|
|
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) -> u64 {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) -> u64 {
|
|
- let saved_application_next_id = Bureaucracy1::next_worker_application_id();
|
|
|
|
- let actual_result = Bureaucracy1::apply_on_worker_opening(
|
|
|
|
|
|
+ let saved_application_next_id = WorkingGroup1::next_worker_application_id();
|
|
|
|
+ let actual_result = WorkingGroup1::apply_on_worker_opening(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.member_id,
|
|
self.member_id,
|
|
self.worker_opening_id,
|
|
self.worker_opening_id,
|
|
@@ -479,12 +479,12 @@ impl ApplyOnWorkerOpeningFixture {
|
|
|
|
|
|
if actual_result.is_ok() {
|
|
if actual_result.is_ok() {
|
|
assert_eq!(
|
|
assert_eq!(
|
|
- Bureaucracy1::next_worker_application_id(),
|
|
|
|
|
|
+ WorkingGroup1::next_worker_application_id(),
|
|
saved_application_next_id + 1
|
|
saved_application_next_id + 1
|
|
);
|
|
);
|
|
let application_id = saved_application_next_id;
|
|
let application_id = saved_application_next_id;
|
|
|
|
|
|
- let actual_application = Bureaucracy1::worker_application_by_id(application_id);
|
|
|
|
|
|
+ let actual_application = WorkingGroup1::worker_application_by_id(application_id);
|
|
|
|
|
|
let expected_application = WorkerApplication {
|
|
let expected_application = WorkerApplication {
|
|
role_account: self.role_account,
|
|
role_account: self.role_account,
|
|
@@ -495,7 +495,7 @@ impl ApplyOnWorkerOpeningFixture {
|
|
|
|
|
|
assert_eq!(actual_application, expected_application);
|
|
assert_eq!(actual_application, expected_application);
|
|
|
|
|
|
- let current_opening = Bureaucracy1::worker_opening_by_id(self.worker_opening_id);
|
|
|
|
|
|
+ let current_opening = WorkingGroup1::worker_opening_by_id(self.worker_opening_id);
|
|
assert!(current_opening
|
|
assert!(current_opening
|
|
.worker_applications
|
|
.worker_applications
|
|
.contains(&application_id));
|
|
.contains(&application_id));
|
|
@@ -520,7 +520,7 @@ impl AcceptWorkerApplicationsFixture {
|
|
|
|
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) {
|
|
let actual_result =
|
|
let actual_result =
|
|
- Bureaucracy1::accept_worker_applications(self.origin.clone().into(), self.opening_id);
|
|
|
|
|
|
+ WorkingGroup1::accept_worker_applications(self.origin.clone().into(), self.opening_id);
|
|
assert_eq!(actual_result, expected_result);
|
|
assert_eq!(actual_result, expected_result);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -529,7 +529,7 @@ pub struct SetLeadFixture;
|
|
impl SetLeadFixture {
|
|
impl SetLeadFixture {
|
|
pub fn set_lead(lead_account_id: u64) {
|
|
pub fn set_lead(lead_account_id: u64) {
|
|
assert_eq!(
|
|
assert_eq!(
|
|
- Bureaucracy1::set_lead(RawOrigin::Root.into(), 1, lead_account_id),
|
|
|
|
|
|
+ WorkingGroup1::set_lead(RawOrigin::Root.into(), 1, lead_account_id),
|
|
Ok(())
|
|
Ok(())
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -541,7 +541,7 @@ impl SetLeadFixture {
|
|
expected_result: Result<(), Error>,
|
|
expected_result: Result<(), Error>,
|
|
) {
|
|
) {
|
|
assert_eq!(
|
|
assert_eq!(
|
|
- Bureaucracy1::set_lead(origin.into(), member_id, account_id),
|
|
|
|
|
|
+ WorkingGroup1::set_lead(origin.into(), member_id, account_id),
|
|
expected_result
|
|
expected_result
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -577,8 +577,8 @@ impl AddWorkerOpeningFixture {
|
|
}
|
|
}
|
|
|
|
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) -> u64 {
|
|
pub fn call_and_assert(&self, expected_result: Result<(), Error>) -> u64 {
|
|
- let saved_opening_next_id = Bureaucracy1::next_worker_opening_id();
|
|
|
|
- let actual_result = Bureaucracy1::add_worker_opening(
|
|
|
|
|
|
+ let saved_opening_next_id = WorkingGroup1::next_worker_opening_id();
|
|
|
|
+ let actual_result = WorkingGroup1::add_worker_opening(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.activate_at.clone(),
|
|
self.activate_at.clone(),
|
|
self.commitment.clone(),
|
|
self.commitment.clone(),
|
|
@@ -588,12 +588,12 @@ impl AddWorkerOpeningFixture {
|
|
|
|
|
|
if actual_result.is_ok() {
|
|
if actual_result.is_ok() {
|
|
assert_eq!(
|
|
assert_eq!(
|
|
- Bureaucracy1::next_worker_opening_id(),
|
|
|
|
|
|
+ WorkingGroup1::next_worker_opening_id(),
|
|
saved_opening_next_id + 1
|
|
saved_opening_next_id + 1
|
|
);
|
|
);
|
|
let opening_id = saved_opening_next_id;
|
|
let opening_id = saved_opening_next_id;
|
|
|
|
|
|
- let actual_opening = Bureaucracy1::worker_opening_by_id(opening_id);
|
|
|
|
|
|
+ let actual_opening = WorkingGroup1::worker_opening_by_id(opening_id);
|
|
|
|
|
|
let expected_opening = WorkerOpening::<u64, u64, u64, u64> {
|
|
let expected_opening = WorkerOpening::<u64, u64, u64, u64> {
|
|
opening_id,
|
|
opening_id,
|
|
@@ -641,7 +641,7 @@ impl EventFixture {
|
|
) {
|
|
) {
|
|
let converted_events = expected_raw_events
|
|
let converted_events = expected_raw_events
|
|
.iter()
|
|
.iter()
|
|
- .map(|ev| TestEvent::bureaucracy_Instance1(ev.clone()))
|
|
|
|
|
|
+ .map(|ev| TestEvent::working_group_Instance1(ev.clone()))
|
|
.collect::<Vec<TestEvent>>();
|
|
.collect::<Vec<TestEvent>>();
|
|
|
|
|
|
Self::assert_global_events(converted_events)
|
|
Self::assert_global_events(converted_events)
|
|
@@ -672,7 +672,7 @@ impl EventFixture {
|
|
crate::Instance1,
|
|
crate::Instance1,
|
|
>,
|
|
>,
|
|
) {
|
|
) {
|
|
- let converted_event = TestEvent::bureaucracy_Instance1(expected_raw_event);
|
|
|
|
|
|
+ let converted_event = TestEvent::working_group_Instance1(expected_raw_event);
|
|
|
|
|
|
Self::assert_last_global_event(converted_event)
|
|
Self::assert_last_global_event(converted_event)
|
|
}
|
|
}
|
|
@@ -717,7 +717,7 @@ impl DecreaseWorkerStakeFixture {
|
|
let stake_id = 0;
|
|
let stake_id = 0;
|
|
let old_balance = Balances::free_balance(&self.account_id);
|
|
let old_balance = Balances::free_balance(&self.account_id);
|
|
let old_stake = <stake::Module<Test>>::stakes(stake_id);
|
|
let old_stake = <stake::Module<Test>>::stakes(stake_id);
|
|
- let actual_result = Bureaucracy1::decrease_worker_stake(
|
|
|
|
|
|
+ let actual_result = WorkingGroup1::decrease_worker_stake(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.worker_id,
|
|
self.worker_id,
|
|
self.balance,
|
|
self.balance,
|
|
@@ -779,7 +779,7 @@ impl SlashWorkerStakeFixture {
|
|
let stake_id = 0;
|
|
let stake_id = 0;
|
|
let old_balance = Balances::free_balance(&self.account_id);
|
|
let old_balance = Balances::free_balance(&self.account_id);
|
|
let old_stake = <stake::Module<Test>>::stakes(stake_id);
|
|
let old_stake = <stake::Module<Test>>::stakes(stake_id);
|
|
- let actual_result = Bureaucracy1::slash_worker_stake(
|
|
|
|
|
|
+ let actual_result = WorkingGroup1::slash_worker_stake(
|
|
self.origin.clone().into(),
|
|
self.origin.clone().into(),
|
|
self.worker_id,
|
|
self.worker_id,
|
|
self.balance,
|
|
self.balance,
|