(self, tmp_path, monkeypatch)
| 527 | |
| 528 | class TestSessionHistory: |
| 529 | def test_save_and_load_round_trip(self, tmp_path, monkeypatch): |
| 530 | import openosint.session_history as sh |
| 531 | |
| 532 | monkeypatch.setattr(sh, "HISTORY_DIR", tmp_path / "history") |
| 533 | from openosint.session_history import SessionRecord, load_sessions, save_session |
| 534 | |
| 535 | record = SessionRecord( |
| 536 | timestamp="2026-05-17T12:00:00", |
| 537 | duration_seconds=42, |
| 538 | prompts=["investigate test@example.com"], |
| 539 | tools_used=["search_email", "search_breach"], |
| 540 | targets=["test@example.com"], |
| 541 | report_path="reports/2026-05-17_report.md", |
| 542 | ) |
| 543 | save_session(record) |
| 544 | sessions = load_sessions() |
| 545 | assert len(sessions) == 1 |
| 546 | s = sessions[0] |
| 547 | assert s["timestamp"] == "2026-05-17T12:00:00" |
| 548 | assert s["duration_seconds"] == 42 |
| 549 | assert s["prompts"] == ["investigate test@example.com"] |
| 550 | assert s["tools_used"] == ["search_email", "search_breach"] |
| 551 | assert s["targets"] == ["test@example.com"] |
| 552 | |
| 553 | def test_load_empty_when_dir_absent(self, tmp_path, monkeypatch): |
| 554 | import openosint.session_history as sh |
nothing calls this directly
no test coverage detected