Files
ThothII/harness/tests/test_local_identity.py

18 lines
482 B
Python

import json
import uuid
from tht.session.models import local_principal
def test_local_identity_uuid_is_stable_across_restarts(tmp_path):
first = local_principal(tmp_path)
restarted = local_principal(tmp_path)
assert first == restarted
assert first.issuer == "local"
assert uuid.UUID(first.subject, version=4).version == 4
assert json.loads((tmp_path / "identity.json").read_text()) == {
"issuer": "local",
"subject": first.subject,
}