Exercise permission catalog and resolution management DTO roundtrips

This commit is contained in:
2026-11-04 11:28:44 +09:00
parent a7f5ecb56a
commit e166117c60
+11 -2
View File
@@ -78,6 +78,11 @@ mod tests {
"../../feature-permissions/tests/fixtures/catalog.json" "../../feature-permissions/tests/fixtures/catalog.json"
)) ))
.unwrap(); .unwrap();
let catalog: PermissionCatalogResponse = serde_json::from_slice(
&serde_json::to_vec(&PermissionCatalogResponse(catalog)).unwrap(),
)
.unwrap();
let catalog = catalog.0;
let mut host = PermissionHost::new(catalog.workspace.clone()); let mut host = PermissionHost::new(catalog.workspace.clone());
for namespace in catalog.namespaces { for namespace in catalog.namespaces {
let owner = host.register_feature(namespace.feature).unwrap(); let owner = host.register_feature(namespace.feature).unwrap();
@@ -92,8 +97,12 @@ mod tests {
let request: PermissionValidationRequest = let request: PermissionValidationRequest =
serde_json::from_slice(&serde_json::to_vec(&request).unwrap()).unwrap(); serde_json::from_slice(&serde_json::to_vec(&request).unwrap()).unwrap();
let result = host.resolve(Some(&request.0.assignment)); let result = host.resolve(Some(&request.0.assignment));
let response: PermissionResolution = let response: PermissionResolutionResponse = serde_json::from_slice(
serde_json::from_slice(&serde_json::to_vec(result.projection()).unwrap()).unwrap(); &serde_json::to_vec(&PermissionResolutionResponse(result.projection().clone()))
.unwrap(),
)
.unwrap();
let response = response.0;
assert!( assert!(
response response
.allowed .allowed