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

Function test_resolve_with_identity

atomic-agent/src/identity.rs:1082–1117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1080
1081 #[test]
1082 fn test_resolve_with_identity() {
1083 let dir = TempDir::new().unwrap();
1084
1085 // Create a mock identity store
1086 let config = r#"
1087default_identity = "TESTID1234567890"
1088version = 1
1089"#;
1090 fs::write(dir.path().join("config.toml"), config).unwrap();
1091
1092 // Create an identity directory
1093 let id_dir = dir.path().join("alice-personal");
1094 fs::create_dir(&id_dir).unwrap();
1095 let identity_toml = r#"
1096id = "TESTID1234567890"
1097name = "Alice"
1098email = "alice@example.com"
1099public_key = "PK_BASE32_ALICE"
1100identity_type = "user"
1101"#;
1102 fs::write(id_dir.join("identity.toml"), identity_toml).unwrap();
1103
1104 let options = AgentAuthorOptions {
1105 agent_name: "claude-code",
1106 agent_display_name: "Claude Code",
1107 session_id: "60f5cbd2-aa23-40ee-9085-4375dd186ce7",
1108 identity_dir: Some(dir.path().to_path_buf()),
1109 agent_identity: None,
1110 };
1111
1112 let author = resolve_agent_author(&options);
1113
1114 assert_eq!(author.name, "claude+60f5");
1115 assert_eq!(author.email, Some("alice@example.com".to_string()));
1116 assert_eq!(author.identity, Some("PK_BASE32_ALICE".to_string()));
1117 }
1118
1119 #[test]
1120 fn test_resolve_with_identity_no_email() {

Callers

nothing calls this directly

Calls 4

resolve_agent_authorFunction · 0.85
writeFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected