FileLedger writes ~/.verae/mcp-timestamp-local.json; hash_report looks up by SHA-256.
20 lines
606 B
Python
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
|