Skip to content

Commit

Permalink
fix(jans-cedarling): broken tests
Browse files Browse the repository at this point in the history
- fix the broken tests due to removing the creation of workload entity
  using the userinfo token

Signed-off-by: rmarinn <[email protected]>
  • Loading branch information
rmarinn committed Dec 27, 2024
1 parent 86ff917 commit cd42f1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion jans-cedarling/cedarling/src/authz/entities/workload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ mod test {
let result = create_workload_entity(entity_mapping, &policy_store, &tokens)
.expect_err("expected to error while creating workload entity");

assert_eq!(result.errors.len(), 3);
assert_eq!(result.errors.len(), 2);
for (_tkn_kind, err) in result.errors.iter() {
assert!(
matches!(err, CreateCedarEntityError::UnavailableToken),
Expand Down
11 changes: 1 addition & 10 deletions jans-cedarling/cedarling/src/tests/mapping_entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ fn test_failed_workload_mapping() {

match err {
AuthorizeError::CreateWorkloadEntity(error) => {
assert_eq!(error.errors.len(), 3, "there should be 3 errors");
assert_eq!(error.errors.len(), 2, "there should be 2 errors");

// check for access token error
let (token_kind, err) = &error.errors[0];
Expand All @@ -245,15 +245,6 @@ fn test_failed_workload_mapping() {
&entity_type,
err,
);

// check for userinfo token error
let (token_kind, err) = &error.errors[2];
assert_eq!(token_kind, &TokenKind::Userinfo);
assert!(
matches!(err, CreateCedarEntityError::MissingClaim(ref claim) if claim == "aud"),
"expected MissinClaim(\"aud\"), got: {:?}",
err
);
},
_ => panic!("expected error CreateWorkloadEntity"),
}
Expand Down

0 comments on commit cd42f1d

Please sign in to comment.