()
| 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#" |
| 620 | default_identity = "TESTID1234567890" |
| 621 | version = 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#" |
| 629 | id = "TESTID1234567890" |
| 630 | name = "Alice" |
| 631 | email = "alice@example.com" |
| 632 | public_key = "PK_BASE32_ALICE" |
| 633 | identity_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() { |
nothing calls this directly
no test coverage detected