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
+1 -5
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use ::test_helpers::{dummy_digest, dummy_hash};
use ::test_helpers::{dummy_digest, dummy_hash, validator_pubkeys};
use futures::{channel::oneshot, future::BoxFuture, prelude::*};
use polkadot_node_subsystem::{
messages::{
@@ -94,10 +94,6 @@ struct TestState {
const OUR_VALIDATOR: Sr25519Keyring = Sr25519Keyring::Alice;
fn validator_pubkeys(val_ids: &[Sr25519Keyring]) -> Vec<ValidatorId> {
val_ids.iter().map(|v| v.public().into()).collect()
}
impl TestState {
fn new() -> Self {
// Initialize the default session 1. No validators are present there.