Skip to content

Commit

Permalink
Adjusts targets to expect either templates or policies (#410)
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Eline <[email protected]>
  • Loading branch information
aaronjeline authored Aug 5, 2024
1 parent 4f551a5 commit 68d9177
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cedar-drt/fuzz/fuzz_targets/convert-policy-cedar-to-json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ fuzz_target!(|src: String| {
.try_into()
.map_err(|e: parser::err::ParseErrors| e.into())
.and_then(|est: est::Policy| {
est.try_into_ast_template(Some(ast::PolicyID::from_string("policy0")))
.map_err(|e| e.into())
est.try_into_ast_policy_or_template(Some(ast::PolicyID::from_string(
"policy0",
)))
.map_err(|e| e.into())
});

match policy_est {
Expand Down
5 changes: 3 additions & 2 deletions cedar-drt/fuzz/fuzz_targets/roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ fn round_trip_json(p: StaticPolicy) -> StaticPolicy {
let json = serde_json::to_value(est).expect("failed to convert EST to JSON");
// read back
let est: est::Policy = serde_json::from_value(json).expect("failed to parse EST from JSON");
println!("{est}");
let template = est
.try_into_ast_template(None)
.try_into_ast_policy_or_template(None)
.expect("failed to convert EST to AST");
template
.try_into()
Expand All @@ -115,7 +116,7 @@ fn round_trip_est(p: &StaticPolicy) -> StaticPolicy {
});
let est: est::Policy = serde_json::from_value(json).expect("failed to parse EST from JSON");
let template = est
.try_into_ast_template(None)
.try_into_ast_policy_or_template(None)
.expect("failed to convert EST to AST");
template
.try_into()
Expand Down

0 comments on commit 68d9177

Please sign in to comment.