MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / round_trip_preserves_endpoint_path

Function round_trip_preserves_endpoint_path

crates/openshell-policy/src/lib.rs:2287–2312  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2285
2286 #[test]
2287 fn round_trip_preserves_endpoint_path() {
2288 let yaml = r#"
2289version: 1
2290network_policies:
2291 test:
2292 name: test
2293 endpoints:
2294 - host: api.example.com
2295 port: 443
2296 path: "/graphql"
2297 protocol: graphql
2298 rules:
2299 - allow:
2300 operation_type: query
2301 binaries:
2302 - { path: /usr/bin/curl }
2303"#;
2304 let proto1 = parse_sandbox_policy(yaml).expect("parse failed");
2305 let yaml_out = serialize_sandbox_policy(&proto1).expect("serialize failed");
2306 let proto2 = parse_sandbox_policy(&yaml_out).expect("re-parse failed");
2307
2308 let ep1 = &proto1.network_policies["test"].endpoints[0];
2309 let ep2 = &proto2.network_policies["test"].endpoints[0];
2310 assert_eq!(ep1.path, "/graphql");
2311 assert_eq!(ep1.path, ep2.path);
2312 }
2313
2314 #[test]
2315 fn round_trip_preserves_multi_port() {

Callers

nothing calls this directly

Calls 2

parse_sandbox_policyFunction · 0.85
serialize_sandbox_policyFunction · 0.85

Tested by

no test coverage detected