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

Function test_resolve_with_identity

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

Source from the content-addressed store, hash-verified

613
614 #[test]
615 fn test_resolve_with_identity() {
616 let dir = TempDir::new().unwrap();
617
618 // Create a mock identity store
619 let config = r#"
620default_identity = "TESTID1234567890"
621version = 1
622"#;
623 fs::write(dir.path().join("config.toml"), config).unwrap();
624
625 // Create an identity directory
626 let id_dir = dir.path().join("alice-personal");
627 fs::create_dir(&id_dir).unwrap();
628 let identity_toml = r#"
629id = "TESTID1234567890"
630name = "Alice"
631email = "alice@example.com"
632public_key = "PK_BASE32_ALICE"
633identity_type = "user"
634"#;
635 fs::write(id_dir.join("identity.toml"), identity_toml).unwrap();
636
637 let options = AgentAuthorOptions {
638 agent_name: "claude-code",
639 agent_display_name: "Claude Code",
640 session_id: "60f5cbd2-aa23-40ee-9085-4375dd186ce7",
641 identity_dir: Some(dir.path().to_path_buf()),
642 };
643
644 let author = resolve_agent_author(&options);
645
646 assert_eq!(author.name, "claude+60f5");
647 assert_eq!(author.email, Some("alice@example.com".to_string()));
648 assert_eq!(author.identity, Some("PK_BASE32_ALICE".to_string()));
649 }
650
651 #[test]
652 fn test_resolve_with_identity_no_email() {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected