mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
[parachains pallet] add unit test
Add unit test in order to check that the submit_parachain_heads() call returns an error when the pallet is halted. Signed-off-by: Serban Iorga <serban@parity.io>
This commit is contained in:
committed by
Bastian Köcher
parent
2a4174db18
commit
66754581ac
@@ -450,7 +450,7 @@ mod tests {
|
|||||||
run_test, test_relay_header, Origin, TestRuntime, PARAS_PALLET_NAME, UNTRACKED_PARACHAIN_ID,
|
run_test, test_relay_header, Origin, TestRuntime, PARAS_PALLET_NAME, UNTRACKED_PARACHAIN_ID,
|
||||||
};
|
};
|
||||||
|
|
||||||
use bp_runtime::BasicOperatingMode;
|
use bp_runtime::{BasicOperatingMode, OwnedBridgeModuleError};
|
||||||
use bp_test_utils::{
|
use bp_test_utils::{
|
||||||
authority_list, generate_owned_bridge_module_tests, make_default_justification,
|
authority_list, generate_owned_bridge_module_tests, make_default_justification,
|
||||||
};
|
};
|
||||||
@@ -562,6 +562,36 @@ mod tests {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn submit_parachain_heads_checks_operating_mode() {
|
||||||
|
let (state_root, proof) = prepare_parachain_heads_proof(vec![(1, head_data(1, 0))]);
|
||||||
|
|
||||||
|
run_test(|| {
|
||||||
|
initialize(state_root);
|
||||||
|
|
||||||
|
// `submit_parachain_heads()` should fail when the pallet is halted.
|
||||||
|
PalletOperatingMode::<TestRuntime>::put(BasicOperatingMode::Halted);
|
||||||
|
assert_noop!(
|
||||||
|
Pallet::<TestRuntime>::submit_parachain_heads(
|
||||||
|
Origin::signed(1),
|
||||||
|
(0, test_relay_header(0, state_root).hash()),
|
||||||
|
vec![ParaId(1), ParaId(2), ParaId(3)],
|
||||||
|
proof.clone(),
|
||||||
|
),
|
||||||
|
Error::<TestRuntime>::BridgeModule(OwnedBridgeModuleError::Halted)
|
||||||
|
);
|
||||||
|
|
||||||
|
// `submit_parachain_heads()` should succeed now that the pallet is resumed.
|
||||||
|
PalletOperatingMode::<TestRuntime>::put(BasicOperatingMode::Normal);
|
||||||
|
assert_ok!(Pallet::<TestRuntime>::submit_parachain_heads(
|
||||||
|
Origin::signed(1),
|
||||||
|
(0, test_relay_header(0, state_root).hash()),
|
||||||
|
vec![ParaId(1)],
|
||||||
|
proof,
|
||||||
|
),);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn imports_initial_parachain_heads() {
|
fn imports_initial_parachain_heads() {
|
||||||
let (state_root, proof) =
|
let (state_root, proof) =
|
||||||
|
|||||||
Reference in New Issue
Block a user