MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / put_then_get_round_trips

Function put_then_get_round_trips

atomic-cli/src/commands/intent/key_cache.rs:221–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

219
220 #[test]
221 fn put_then_get_round_trips() {
222 let dir = scratch_dir("roundtrip");
223 let mut cache = PublicKeyCache::open_at(dir.as_path());
224 cache.put(SERVER, "lee", KEY, "active");
225
226 let hit = cache.get(SERVER, "lee").unwrap();
227 assert_eq!(hit.public_key, KEY);
228 assert!(hit.source_line().contains("local key cache"));
229
230 // And a re-open from disk sees the persisted entry.
231 let reopened = PublicKeyCache::open_at(dir.as_path());
232 assert_eq!(
233 reopened.get(SERVER, "lee").map(|c| c.public_key).as_deref(),
234 Some(KEY.into())
235 );
236 }
237
238 #[test]
239 fn same_name_on_another_server_is_a_miss() {

Callers

nothing calls this directly

Calls 4

scratch_dirFunction · 0.85
getMethod · 0.65
putMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected