25 lines
881 B
Python
25 lines
881 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import json
|
||
|
|
from decimal import Decimal
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
from observatory.api import build_dashboard_payload, payload_json
|
||
|
|
|
||
|
|
DATA_DIR = Path(__file__).resolve().parent.parent / "data"
|
||
|
|
|
||
|
|
|
||
|
|
def test_dashboard_payload_contains_live_ledger_totals() -> None:
|
||
|
|
payload = build_dashboard_payload(DATA_DIR, "2026-06")
|
||
|
|
|
||
|
|
assert payload["period"] == "2026-06"
|
||
|
|
assert payload["liquidity"]["remaining_budget"] == "659.12"
|
||
|
|
assert payload["liquidity"]["cumulative_infrastructure_cost"] == "409.28"
|
||
|
|
assert payload["snapshot"]["monthly_infrastructure_cost"] == "29.73"
|
||
|
|
assert len(payload["history"]) == 18
|
||
|
|
assert payload["expense_record_count"] == 58
|
||
|
|
|
||
|
|
|
||
|
|
def test_payload_json_is_valid() -> None:
|
||
|
|
parsed = json.loads(payload_json(DATA_DIR, "2026-06"))
|
||
|
|
assert Decimal(parsed["payments"][0]["fees_amount"]) == Decimal("0.44")
|