MCPcopy Create free account
hub / github.com/OpenOSINT/OpenOSINT / test_save_and_load_round_trip

Method test_save_and_load_round_trip

tests/test_tools.py:529–551  ·  view source on GitHub ↗
(self, tmp_path, monkeypatch)

Source from the content-addressed store, hash-verified

527
528class 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

Callers

nothing calls this directly

Calls 3

SessionRecordClass · 0.90
save_sessionFunction · 0.90
load_sessionsFunction · 0.90

Tested by

no test coverage detected