Skip to content
Snippets Groups Projects
Commit 72b30e37 authored by Éloïs's avatar Éloïs
Browse files

sanity tests should not panic

parent 48abb408
No related branches found
No related tags found
1 merge request!76tests(live): add sanity tests against gdev live chain
This commit is part of merge request !76. Comments created here will be created in the context of that merge request.
......@@ -203,19 +203,23 @@ mod verifier {
) -> anyhow::Result<()> {
for (idty_index, idty_value) in identities {
// Rule 1: each identity should have an account
let idty_account = accounts
.get(&idty_value.owner_key)
.unwrap_or_else(|| panic!("Identity {} has no account", idty_index));
// Rule 2: each identity account should be sufficient
let maybe_account = accounts.get(&idty_value.owner_key);
self.assert(
idty_account.sufficients > 0,
format!(
"Identity {} is corrupted: idty_account.sufficients == 0",
idty_index
),
maybe_account.is_some(),
format!("Identity {} has no account", idty_index),
);
if let Some(account) = maybe_account {
// Rule 2: each identity account should be sufficient
self.assert(
account.sufficients > 0,
format!(
"Identity {} is corrupted: idty_account.sufficients == 0",
idty_index
),
);
}
match idty_value.status {
IdtyStatus::Validated => {
// Rule 3: If the identity is validated, removable_on shoud be zero
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment