串行验证通过
This commit is contained in:
37
tests/test_policy.rs
Normal file
37
tests/test_policy.rs
Normal file
@@ -0,0 +1,37 @@
|
||||
use rpki::policy::{CaFailedFetchPolicy, Policy, SignedObjectFailurePolicy, SyncPreference};
|
||||
|
||||
#[test]
|
||||
fn policy_defaults_are_correct() {
|
||||
let p = Policy::default();
|
||||
assert_eq!(p.sync_preference, SyncPreference::RrdpThenRsync);
|
||||
assert_eq!(
|
||||
p.ca_failed_fetch_policy,
|
||||
CaFailedFetchPolicy::UseVerifiedCache
|
||||
);
|
||||
assert_eq!(
|
||||
p.signed_object_failure_policy,
|
||||
SignedObjectFailurePolicy::DropObject
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn policy_toml_parsing_supports_overrides() {
|
||||
let toml = r#"
|
||||
sync_preference = "rsync_only"
|
||||
ca_failed_fetch_policy = "stop_all_output"
|
||||
signed_object_failure_policy = "drop_publication_point"
|
||||
"#;
|
||||
let p = Policy::from_toml_str(toml).expect("parse TOML policy");
|
||||
assert_eq!(p.sync_preference, SyncPreference::RsyncOnly);
|
||||
assert_eq!(p.ca_failed_fetch_policy, CaFailedFetchPolicy::StopAllOutput);
|
||||
assert_eq!(
|
||||
p.signed_object_failure_policy,
|
||||
SignedObjectFailurePolicy::DropPublicationPoint
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn policy_toml_parsing_uses_defaults_when_missing() {
|
||||
let p = Policy::from_toml_str("").expect("parse empty TOML policy");
|
||||
assert_eq!(p, Policy::default());
|
||||
}
|
||||
Reference in New Issue
Block a user