mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
Half of tests fixed.
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate substrate_runtime_std as rstd;
|
||||
|
||||
#[macro_use]
|
||||
|
||||
@@ -189,9 +189,7 @@ mod tests {
|
||||
|
||||
// Block 1: Make proposal. Approve it. Era length changes.
|
||||
with_env(|e| e.block_number = 1);
|
||||
public::propose(&one, &Proposal {
|
||||
function: Proposal::StakingSetSessionsPerEra(2),
|
||||
});
|
||||
public::propose(&one, &Proposal::StakingSetSessionsPerEra(2));
|
||||
public::approve(&two, 1);
|
||||
staking::internal::check_new_era();
|
||||
assert_eq!(staking::era_length(), 2);
|
||||
@@ -214,17 +212,13 @@ mod tests {
|
||||
|
||||
// Block 1: Make proposal. Fail it.
|
||||
with_env(|e| e.block_number = 1);
|
||||
public::propose(&one, &Proposal {
|
||||
function: Proposal::StakingSetSessionsPerEra(2),
|
||||
});
|
||||
public::propose(&one, &Proposal::StakingSetSessionsPerEra(2));
|
||||
staking::internal::check_new_era();
|
||||
assert_eq!(staking::era_length(), 1);
|
||||
|
||||
// Block 2: Make proposal. Approve it. It should change era length.
|
||||
with_env(|e| e.block_number = 2);
|
||||
public::propose(&one, &Proposal {
|
||||
function: Proposal::StakingSetSessionsPerEra(2),
|
||||
});
|
||||
public::propose(&one, &Proposal::StakingSetSessionsPerEra(2));
|
||||
public::approve(&two, 2);
|
||||
staking::internal::check_new_era();
|
||||
assert_eq!(staking::era_length(), 2);
|
||||
@@ -247,9 +241,7 @@ mod tests {
|
||||
|
||||
// Block 1: Make proposal. Will have only 1 vote. No change.
|
||||
with_env(|e| e.block_number = 1);
|
||||
public::propose(&one, &Proposal {
|
||||
function: Proposal::StakingSetSessionsPerEra(2),
|
||||
});
|
||||
public::propose(&one, &Proposal::StakingSetSessionsPerEra(2));
|
||||
staking::internal::check_new_era();
|
||||
assert_eq!(staking::era_length(), 1);
|
||||
});
|
||||
@@ -272,9 +264,7 @@ mod tests {
|
||||
|
||||
// Block 1: Make proposal. Will have only 1 vote. No change.
|
||||
with_env(|e| e.block_number = 1);
|
||||
public::propose(&one, &Proposal {
|
||||
function: Proposal::StakingSetSessionsPerEra(2),
|
||||
});
|
||||
public::propose(&one, &Proposal::StakingSetSessionsPerEra(2));
|
||||
public::approve(&two, 0);
|
||||
staking::internal::check_new_era();
|
||||
assert_eq!(staking::era_length(), 1);
|
||||
@@ -298,9 +288,7 @@ mod tests {
|
||||
|
||||
// Block 1: Make proposal. Will have only 1 vote. No change.
|
||||
with_env(|e| e.block_number = 1);
|
||||
public::propose(&one, &Proposal {
|
||||
function: Proposal::StakingSetSessionsPerEra(2),
|
||||
});
|
||||
public::propose(&one, &Proposal::StakingSetSessionsPerEra(2));
|
||||
public::approve(&two, 1);
|
||||
public::approve(&two, 1);
|
||||
staking::internal::check_new_era();
|
||||
@@ -325,12 +313,8 @@ mod tests {
|
||||
|
||||
// Block 1: Make proposal. Will have only 1 vote. No change.
|
||||
with_env(|e| e.block_number = 1);
|
||||
public::propose(&one, &Proposal {
|
||||
function: Proposal::StakingSetSessionsPerEra(2),
|
||||
});
|
||||
public::propose(&two, &Proposal {
|
||||
function: Proposal::StakingSetSessionsPerEra(2),
|
||||
});
|
||||
public::propose(&one, &Proposal::StakingSetSessionsPerEra(2));
|
||||
public::propose(&two, &Proposal::StakingSetSessionsPerEra(2));
|
||||
staking::internal::check_new_era();
|
||||
assert_eq!(staking::era_length(), 1);
|
||||
});
|
||||
@@ -377,9 +361,7 @@ mod tests {
|
||||
|
||||
// Block 1: Make proposal. Will have only 1 vote. No change.
|
||||
with_env(|e| e.block_number = 1);
|
||||
public::propose(&one, &Proposal {
|
||||
function: Proposal::StakingSetSessionsPerEra(2),
|
||||
});
|
||||
public::propose(&one, &Proposal::StakingSetSessionsPerEra(2));
|
||||
public::approve(&four, 1);
|
||||
staking::internal::check_new_era();
|
||||
assert_eq!(staking::era_length(), 1);
|
||||
|
||||
@@ -338,12 +338,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn proposals_can_be_stored() {
|
||||
use polkadot_primitives::{Proposal, InternalFunction};
|
||||
use polkadot_primitives::Proposal;
|
||||
let mut t = TestExternalities { storage: HashMap::new(), };
|
||||
with_externalities(&mut t, || {
|
||||
let x = Proposal {
|
||||
function: InternalFunction::StakingSetSessionsPerEra(25519),
|
||||
};
|
||||
let x = Proposal::StakingSetSessionsPerEra(25519);
|
||||
put(b":test", &x);
|
||||
let y: Proposal = get(b":test").unwrap();
|
||||
assert_eq!(x, y);
|
||||
|
||||
Reference in New Issue
Block a user