Fix code duplication in tests (#1575)

This commit is contained in:
Tsvetomir Dimitrov
2023-09-14 22:49:37 +03:00
committed by GitHub
parent 756347ab24
commit d81a2e2fa9
6 changed files with 124 additions and 452 deletions
@@ -17,11 +17,11 @@
use super::*;
use frame_support::{assert_err, assert_ok, assert_storage_noop};
use keyring::Sr25519Keyring;
use primitives::{BlockNumber, ValidatorId, PARACHAIN_KEY_TYPE_ID};
use primitives::{BlockNumber, PARACHAIN_KEY_TYPE_ID};
use sc_keystore::LocalKeystore;
use sp_keystore::{Keystore, KeystorePtr};
use std::sync::Arc;
use test_helpers::{dummy_head_data, dummy_validation_code};
use test_helpers::{dummy_head_data, dummy_validation_code, validator_pubkeys};
use crate::{
configuration::HostConfiguration,
@@ -39,10 +39,6 @@ static VALIDATORS: &[Sr25519Keyring] = &[
Sr25519Keyring::Ferdie,
];
fn validator_pubkeys(val_ids: &[Sr25519Keyring]) -> Vec<ValidatorId> {
val_ids.iter().map(|v| v.public().into()).collect()
}
fn sign_and_include_pvf_check_statement(stmt: PvfCheckStatement) {
let validators = &[
Sr25519Keyring::Alice,
@@ -22,10 +22,7 @@ use crate::{
use assert_matches::assert_matches;
use keyring::Sr25519Keyring;
use primitives::Hash;
fn validator_pubkeys(val_ids: &[Sr25519Keyring]) -> Vec<ValidatorId> {
val_ids.iter().map(|v| v.public().into()).collect()
}
use test_helpers::validator_pubkeys;
#[test]
fn tracker_earliest_block_number() {