Skip to content

Commit ea27913

Browse files
committed
revert cedar testing changes
1 parent 127cae9 commit ea27913

File tree

3 files changed

+1
-40
lines changed

3 files changed

+1
-40
lines changed

cedar-testing/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ default = ["ipaddr", "decimal"]
2020
decimal = ["cedar-policy/decimal"]
2121
ipaddr = ["cedar-policy/ipaddr"]
2222
integration-testing = []
23-
entity-manifest = ["cedar-policy/entity-manifest"]
2423

2524
[dev-dependencies]
2625
assert_cmd = "2.0"

cedar-testing/src/cedar_test_impl.rs

-38
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ use cedar_policy_core::authorizer::Authorizer;
2626
use cedar_policy_core::entities::{Entities, TCComputation};
2727
use cedar_policy_core::evaluator::Evaluator;
2828
use cedar_policy_core::extensions::Extensions;
29-
#[cfg(feature = "entity-manifest")]
30-
use cedar_policy_validator::entity_manifest::compute_entity_manifest;
3129
use cedar_policy_validator::{ValidationMode, Validator, ValidatorSchema};
3230
use core::panic;
3331
use miette::miette;
@@ -160,7 +158,6 @@ pub trait CedarTestImplementation {
160158
/// Custom authorizer entry point.
161159
fn is_authorized(
162160
&self,
163-
schema: &ValidatorSchema,
164161
request: &Request,
165162
policies: &PolicySet,
166163
entities: &Entities,
@@ -285,7 +282,6 @@ where
285282
impl CedarTestImplementation for RustEngine {
286283
fn is_authorized(
287284
&self,
288-
schema: &ValidatorSchema,
289285
request: &Request,
290286
policies: &PolicySet,
291287
entities: &Entities,
@@ -317,40 +313,6 @@ impl CedarTestImplementation for RustEngine {
317313
response,
318314
timing_info: HashMap::from([("authorize".into(), Micros(duration.as_micros()))]),
319315
};
320-
321-
// now check that we get the same response with entity manifest, as long as the schema is valid
322-
#[cfg(feature = "entity-manifest")]
323-
{
324-
let validator = Validator::new(schema.clone());
325-
let validation_result = validator.validate(policies, ValidationMode::Strict);
326-
if validation_result.validation_passed() {
327-
let entity_manifest = match compute_entity_manifest(schema, policies) {
328-
Ok(entity_manifest) => entity_manifest,
329-
Err(err) => {
330-
return TestResult::Failure(format!(
331-
"Failed to compute entity manifest. Error: {}",
332-
err
333-
));
334-
}
335-
};
336-
let entity_slice = match entity_manifest.slice_entities(entities, request) {
337-
Ok(slice) => slice,
338-
Err(err) => {
339-
return TestResult::Failure(format!(
340-
"Failed to slice entities. Error: {}",
341-
err
342-
));
343-
}
344-
};
345-
346-
let slice_response =
347-
authorizer.is_authorized(request.clone(), policies, &entity_slice);
348-
if response.response.decision() != slice_response.decision {
349-
return TestResult::Failure(format!("Response decision differed with and without entity slicing. \nWithout: {:?}\nWith: {:?}\n", response.response.decision(), slice_response.decision));
350-
}
351-
}
352-
}
353-
354316
TestResult::Success(response)
355317
}
356318

cedar-testing/src/integration_testing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ pub fn perform_integration_test(
292292
for json_request in requests {
293293
let request = parse_request_from_test(&json_request, &schema, test_name);
294294
let response = test_impl
295-
.is_authorized(&schema, &request, &policies, &entities)
295+
.is_authorized(&request, &policies, &entities)
296296
.expect("Authorization failed");
297297
// check decision
298298
assert_eq!(

0 commit comments

Comments
 (0)