"""GET /scores/history returns a list of weekly data points — regression test for a response-model mismatch (endpoint annotated -> dict while the service actually returns a list, causing a raw 500 on serialization).""" def test_scores_history_returns_a_list(client, auth_headers): resp = client.get("/api/v1/scores/history", headers=auth_headers) assert resp.status_code == 200, resp.text body = resp.json() assert isinstance(body, list) def test_scores_history_accepts_all_periods(client, auth_headers): for period in ("30d", "90d", "1y"): resp = client.get( "/api/v1/scores/history", params={"period": period}, headers=auth_headers, ) assert resp.status_code == 200, resp.text assert isinstance(resp.json(), list)