generated from coulomb/repo-seed
Add file-based Bubble, Stripe, and OpenRouter importers; usage attribution, cost allocation, pricing simulator, credit wallets, and recommendations in the dashboard API. Document whynot-design UI workflow and archive the finished workplan with all ten tasks marked done.
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
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
|
|
assert payload["cost_floor"]["active_price"] == "8.99"
|
|
assert len(payload["value_range"]["segments"]) == 2
|
|
assert payload["market_price"]["alternative_count"] == 4
|
|
assert payload["membership_analytics"]["active_members"] == 1
|
|
assert payload["usage"]["record_count"] == 1
|
|
assert len(payload["pricing_simulations"]["scenarios"]) == 3
|
|
assert payload["recommendations"]
|
|
|
|
|
|
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") |