()
| 650 | |
| 651 | #[test] |
| 652 | fn test_resolve_with_identity_no_email() { |
| 653 | let dir = TempDir::new().unwrap(); |
| 654 | |
| 655 | let config = r#"default_identity = "NOEMAIL_ID""#; |
| 656 | fs::write(dir.path().join("config.toml"), config).unwrap(); |
| 657 | |
| 658 | let id_dir = dir.path().join("bob-agent"); |
| 659 | fs::create_dir(&id_dir).unwrap(); |
| 660 | let identity_toml = r#" |
| 661 | id = "NOEMAIL_ID" |
| 662 | name = "Bob" |
| 663 | public_key = "PK_BOB" |
| 664 | identity_type = "user" |
| 665 | "#; |
| 666 | fs::write(id_dir.join("identity.toml"), identity_toml).unwrap(); |
| 667 | |
| 668 | let options = AgentAuthorOptions { |
| 669 | agent_name: "gemini-cli", |
| 670 | agent_display_name: "Gemini CLI", |
| 671 | session_id: "abcdef12", |
| 672 | identity_dir: Some(dir.path().to_path_buf()), |
| 673 | }; |
| 674 | |
| 675 | let author = resolve_agent_author(&options); |
| 676 | |
| 677 | assert_eq!(author.name, "gemini+abcd"); |
| 678 | assert!(author.email.is_none()); |
| 679 | assert_eq!(author.identity, Some("PK_BOB".to_string())); |
| 680 | } |
| 681 | |
| 682 | // build_agent_author (convenience function) |
| 683 |
nothing calls this directly
no test coverage detected