Make Test Helpers no_std Compatible (#823)

* Use `sp-application-crypto` when generating test justifications

* Try to justifications tests compiling

* Try using `ed25519_dalek` for justification creation

* Small cleanup

* Correctly generate a Keypair

The public key didn't correspond to what would be derived
with the given private key.

* Remove enum index hack

* Clean up test account helper functions

* Fix tests in `pallet-finality-verifier`

* Get `pallet-substrate-bridge` tests compiling again

* Use the correct keyring in justification tests

* Clean up Keyring related code a bit

* Appease Clippy

* Remove unused import

* Use keyring variants directly

* Remove unecessary From implementation
This commit is contained in:
Hernando Castano
2021-03-18 16:46:52 -04:00
committed by Bastian Köcher
parent 401d3847d1
commit eb7c96ba14
7 changed files with 128 additions and 86 deletions
+7 -4
View File
@@ -721,7 +721,10 @@ mod tests {
use super::*;
use crate::mock::{run_test, test_header, unfinalized_header, Origin, TestHeader, TestRuntime};
use bp_header_chain::HeaderChain;
use bp_test_utils::{alice, authority_list, bob};
use bp_test_utils::{
authority_list,
Keyring::{Alice, Bob},
};
use frame_support::{assert_err, assert_noop, assert_ok};
use sp_runtime::DispatchError;
@@ -949,7 +952,7 @@ mod tests {
let storage = PalletStorage::<TestRuntime>::new();
let next_set_id = 2;
let next_authorities = vec![(alice(), 1), (bob(), 1)];
let next_authorities = vec![(Alice.into(), 1), (Bob.into(), 1)];
// Need to update the header digest to indicate that our header signals an authority set
// change. The change will be enacted when we import our header.
@@ -978,7 +981,7 @@ mod tests {
let storage = PalletStorage::<TestRuntime>::new();
let next_set_id = 2;
let next_authorities = vec![(alice(), 1), (bob(), 1)];
let next_authorities = vec![(Alice.into(), 1), (Bob.into(), 1)];
// Need to update the header digest to indicate that our header signals an authority set
// change. However, the change doesn't happen until the next block.
@@ -1007,7 +1010,7 @@ mod tests {
run_test(|| {
let storage = PalletStorage::<TestRuntime>::new();
let next_authorities = vec![(alice(), 1)];
let next_authorities = vec![(Alice.into(), 1)];
let next_set_id = 2;
let next_authority_set = AuthoritySet::new(next_authorities.clone(), next_set_id);