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

Function test_remote_config_save_and_load

atomic-repository/src/remote.rs:1013–1034  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1011
1012 #[test]
1013 fn test_remote_config_save_and_load() {
1014 let dir = tempdir().unwrap();
1015 let path = dir.path().join("config.toml");
1016
1017 let mut config = RemoteConfig::new();
1018 config
1019 .add(
1020 "origin",
1021 RemoteEntry::new_default("https://origin.com/repo"),
1022 )
1023 .unwrap();
1024 config
1025 .add("upstream", RemoteEntry::new("https://upstream.com/repo"))
1026 .unwrap();
1027
1028 config.save(&path).unwrap();
1029
1030 let loaded = RemoteConfig::load(&path).unwrap();
1031 assert_eq!(loaded.len(), 2);
1032 assert!(loaded.get("origin").unwrap().default);
1033 assert!(!loaded.get("upstream").unwrap().default);
1034 }
1035
1036 #[test]
1037 fn test_remote_config_save_preserves_other_sections() {

Callers

nothing calls this directly

Calls 4

unwrapMethod · 0.45
pathMethod · 0.45
addMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected