27 lines
1004 B
Python
27 lines
1004 B
Python
"""The /funnel route renders the latest factory cycle's funnel counts + the deployed HRP weights."""
|
|
from __future__ import annotations
|
|
|
|
import datetime as dt
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from fxhnt.adapters.persistence.factory_store import FactoryStore
|
|
from fxhnt.adapters.persistence.forward_nav import ForwardNavRepo
|
|
from fxhnt.adapters.web.app import create_app
|
|
|
|
|
|
def _client():
|
|
repo = ForwardNavRepo("sqlite://"); repo.migrate()
|
|
fs = FactoryStore("sqlite://")
|
|
at = dt.datetime(2026, 6, 15)
|
|
fs.record_cycle(cycle_id="c1", proposed=20, tested=20, survived=4, forward=9, deployed=3, retired=1,
|
|
global_trials=12000, at=at)
|
|
fs.record_allocation("c1", {"crypto-mom": 0.5, "carry": 0.3, "vrp": 0.2}, at)
|
|
return TestClient(create_app(repo, factory_store=fs))
|
|
|
|
|
|
def test_funnel_route() -> None:
|
|
r = _client().get("/funnel")
|
|
assert r.status_code == 200
|
|
assert "12000" in r.text and "crypto-mom" in r.text and "deployed" in r.text.lower()
|