Skip to content

Commit

Permalink
Add Test for Parsing JWKS with Empty Keys Array (#89)
Browse files Browse the repository at this point in the history
Add test_parse_jwks_with_empty_keys_array

Signed-off-by: Max Lambrecht <[email protected]>
  • Loading branch information
maxlambrecht authored Apr 8, 2024
1 parent d28aca3 commit 446b0b2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spiffe/src/bundle/jwt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,17 @@ mod jwt_bundle_test {
JwtBundleError::Deserialize(..)
));
}

#[test]
fn test_parse_jwks_with_empty_keys_array() {
let bundle_bytes = r#"{"keys": []}"#.as_bytes();
let trust_domain = TrustDomain::new("domain.test").unwrap();
let jwt_bundle = JwtBundle::from_jwt_authorities(trust_domain, bundle_bytes)
.expect("Failed to parse JWKS with empty keys array");

assert!(
jwt_bundle.jwt_authorities.is_empty(),
"JWT authorities should be empty"
);
}
}

0 comments on commit 446b0b2

Please sign in to comment.