verae-mcp-timestamping-server/tests/test_file_ledger.py
George Lambert 77872a720c feat: persist local receipts so /verify works across sessions
FileLedger writes ~/.verae/mcp-timestamp-local.json; hash_report looks up by SHA-256.
2026-09-20 09:56:11 -04:00

20 lines
606 B
Python

"""File ledger survives a new process/instance."""
from pathlib import Path
import pytest
from verae_mcp_timestamping_server.ledger import SHA256_EMPTY, FileLedger
pytestmark = pytest.mark.anyio
async def test_stamp_survives_reload(tmp_path: Path):
path = tmp_path / "receipts.json"
first = FileLedger(path)
[rec] = await first.stamp(SHA256_EMPTY, scope="local")
second = FileLedger(path)
report = await second.hash_report(SHA256_EMPTY)
assert report[0].receipt_id == rec.receipt_id
ok = await second.verify(rec.receipt_id, want_scope="local")
assert ok.valid is True