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

Function rewrite_target_for_eval_roundtrip

crates/openshell-core/src/secrets.rs:2138–2156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2136
2137 #[test]
2138 fn rewrite_target_for_eval_roundtrip() {
2139 let (child_env, resolver) = SecretResolver::from_provider_env(
2140 [
2141 ("TOKEN".to_string(), "tok123".to_string()),
2142 ("KEY".to_string(), "key456".to_string()),
2143 ]
2144 .into_iter()
2145 .collect(),
2146 );
2147 let resolver = resolver.expect("resolver");
2148 let tok_ph = child_env.get("TOKEN").unwrap();
2149 let key_ph = child_env.get("KEY").unwrap();
2150
2151 let target = format!("/bot{tok_ph}/method?key={key_ph}");
2152 let result = rewrite_target_for_eval(&target, &resolver).expect("should succeed");
2153
2154 assert_eq!(result.resolved, "/bottok123/method?key=key456");
2155 assert_eq!(result.redacted, "/bot[CREDENTIAL]/method?key=[CREDENTIAL]");
2156 }
2157}

Callers

nothing calls this directly

Calls 2

rewrite_target_for_evalFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected