| 1729 | |
| 1730 | #[test] |
| 1731 | fn test_default_workspaces_roundtrip() { |
| 1732 | let mut workspaces = BTreeMap::new(); |
| 1733 | workspaces.insert("alice".to_string(), "personal".to_string()); |
| 1734 | workspaces.insert("acme".to_string(), "backend".to_string()); |
| 1735 | |
| 1736 | let config = ServerConfig { |
| 1737 | url: Some("https://atomic.storage".to_string()), |
| 1738 | default_org: Some("alice".to_string()), |
| 1739 | default_workspaces: workspaces, |
| 1740 | identity: None, |
| 1741 | agent_identity: None, |
| 1742 | single_tenant: false, |
| 1743 | }; |
| 1744 | |
| 1745 | let toml_str = toml::to_string_pretty(&config).unwrap(); |
| 1746 | assert!(toml_str.contains("[default_workspaces]")); |
| 1747 | |
| 1748 | // BTreeMap → alphabetical, so "acme" appears before "alice" |
| 1749 | let acme_pos = toml_str.find("acme = \"backend\"").unwrap(); |
| 1750 | let alice_pos = toml_str.find("alice = \"personal\"").unwrap(); |
| 1751 | assert!(acme_pos < alice_pos); |
| 1752 | |
| 1753 | let parsed: ServerConfig = toml::from_str(&toml_str).unwrap(); |
| 1754 | assert_eq!( |
| 1755 | parsed.default_workspaces.get("alice"), |
| 1756 | Some(&"personal".to_string()) |
| 1757 | ); |
| 1758 | assert_eq!( |
| 1759 | parsed.default_workspaces.get("acme"), |
| 1760 | Some(&"backend".to_string()) |
| 1761 | ); |
| 1762 | } |
| 1763 | |
| 1764 | #[test] |
| 1765 | fn test_resolve_server_mut_targets_named_profile() { |