41 lines
868 B
Python
41 lines
868 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from datetime import datetime, timezone
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
from maturity_engine.engine import Engine
|
||
|
|
from maturity_engine.models import Evidence
|
||
|
|
|
||
|
|
INSTANT = datetime(2026, 8, 29, 12, 0, tzinfo=timezone.utc)
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.fixture
|
||
|
|
def engine(tmp_path: Path) -> Engine:
|
||
|
|
inst = Engine.open(tmp_path / "maturity.sqlite")
|
||
|
|
inst.bootstrap(at=INSTANT)
|
||
|
|
yield inst
|
||
|
|
inst.close()
|
||
|
|
|
||
|
|
|
||
|
|
def evidence(
|
||
|
|
engine: Engine,
|
||
|
|
subject: str,
|
||
|
|
kind: str,
|
||
|
|
*,
|
||
|
|
at: datetime = INSTANT,
|
||
|
|
until: datetime | None = None,
|
||
|
|
by: str = "fixture",
|
||
|
|
) -> Evidence:
|
||
|
|
return Evidence(
|
||
|
|
id=engine.evidence_id(subject, kind, at),
|
||
|
|
subject=subject,
|
||
|
|
kind=kind,
|
||
|
|
submitted_by=by,
|
||
|
|
submitted_at=at,
|
||
|
|
valid_from=at,
|
||
|
|
valid_until=until,
|
||
|
|
payload={"kind": kind},
|
||
|
|
)
|