MCPcopy Create free account
hub / github.com/dfinity/orbit / assert_initial_named_rules

Function assert_initial_named_rules

tests/integration/src/install_tests.rs:844–872  ·  view source on GitHub ↗
(
    env: &PocketIc,
    canister_id: Principal,
    requester: Principal,
    expected_named_rules: &Vec<InitNamedRuleInput>,
)

Source from the content-addressed store, hash-verified

842}
843
844fn assert_initial_named_rules(
845 env: &PocketIc,
846 canister_id: Principal,
847 requester: Principal,
848 expected_named_rules: &Vec<InitNamedRuleInput>,
849) -> Result<(), String> {
850 let listed_named_rules = list_named_rules(env, canister_id, requester)
851 .expect("failed to get named rules")
852 .0
853 .expect("failed to get named rules");
854
855 if expected_named_rules.len() != listed_named_rules.named_rules.len() {
856 return Err(format!(
857 "expected {} named rules, got {}",
858 expected_named_rules.len(),
859 listed_named_rules.named_rules.len()
860 ));
861 }
862
863 for expected_named_rule in expected_named_rules {
864 let _named_rule = listed_named_rules
865 .named_rules
866 .iter()
867 .find(|named_rule| named_rule.name == expected_named_rule.name)
868 .ok_or(format!("named rule {} not found", expected_named_rule.name))?;
869 }
870
871 Ok(())
872}
873
874fn assert_initial_assets(
875 env: &PocketIc,

Callers 1

install_with_all_entriesFunction · 0.85

Calls 3

iterMethod · 0.80
list_named_rulesFunction · 0.50
lenMethod · 0.45

Tested by

no test coverage detected