Thread-local parameter_types for testing. (#7542)

* Thread-local parameter_types for testing.

* Better docs.

* Some minors

* Merge'em

* Update frame/support/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Align more to basti's trick

* Update frame/support/src/lib.rs

* Update frame/support/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Kian Paimani
2020-11-20 18:54:19 +01:00
committed by GitHub
parent 52d261e3c7
commit b64b17536a
12 changed files with 128 additions and 217 deletions
+6 -6
View File
@@ -298,7 +298,7 @@ fn voting_initial_set_approvals_ignores_voter_index() {
}
#[test]
fn voting_bad_approval_index_slashes_voters_and_bond_reduces_stake() {
ExtBuilder::default().voting_fee(5).voter_bond(2).build().execute_with(|| {
ExtBuilder::default().voting_fee(5).voting_bond(2).build().execute_with(|| {
assert_ok!(Elections::submit_candidacy(Origin::signed(2), 0));
(1..=63).for_each(|i| vote(i, 0));
@@ -365,7 +365,7 @@ fn voting_cannot_lock_less_than_limit() {
#[test]
fn voting_locking_more_than_total_balance_is_moot() {
ExtBuilder::default().voter_bond(2).build().execute_with(|| {
ExtBuilder::default().voting_bond(2).build().execute_with(|| {
assert_ok!(Elections::submit_candidacy(Origin::signed(2), 0));
assert_eq!(balances(&3), (30, 0));
@@ -381,7 +381,7 @@ fn voting_locking_more_than_total_balance_is_moot() {
#[test]
fn voting_locking_stake_and_reserving_bond_works() {
ExtBuilder::default().voter_bond(2).build().execute_with(|| {
ExtBuilder::default().voting_bond(2).build().execute_with(|| {
assert_ok!(Elections::submit_candidacy(Origin::signed(5), 0));
assert_eq!(balances(&2), (20, 0));
@@ -558,7 +558,7 @@ fn retracting_inactive_voter_should_work() {
#[test]
fn retracting_inactive_voter_with_other_candidates_in_slots_should_work() {
ExtBuilder::default().voter_bond(2).build().execute_with(|| {
ExtBuilder::default().voting_bond(2).build().execute_with(|| {
System::set_block_number(4);
assert_ok!(Elections::submit_candidacy(Origin::signed(2), 0));
assert_ok!(Elections::set_approvals(Origin::signed(2), vec![true], 0, 0, 20));
@@ -1107,7 +1107,7 @@ fn election_present_when_presenter_is_poor_should_not_work() {
let test_present = |p| {
ExtBuilder::default()
.voting_fee(5)
.voter_bond(2)
.voting_bond(2)
.bad_presentation_punishment(p)
.build()
.execute_with(|| {
@@ -1507,7 +1507,7 @@ fn pot_winning_resets_accumulated_pot() {
#[test]
fn pot_resubmitting_approvals_stores_pot() {
ExtBuilder::default()
.voter_bond(0)
.voting_bond(0)
.voting_fee(0)
.balance_factor(10)
.build()