def test_list_tournaments(client): r = client.get("/api/tss/tournaments") assert r.json()["tournaments"][0]["tournament_id"] == 24839 def test_tournament_detail(client): r = client.get("/api/tss/tournament/24839") body = r.json() assert body["tournament"]["name"] == "Cadet 1x1 RB Air" assert body["standings"][0]["team_name"] == "BenisPutt" assert len(body["matches"]) == 1 def test_tournament_unknown_404(client): assert client.get("/api/tss/tournament/999").status_code == 404 def test_tournament_matches_coerce_empty_to_null(client): r = client.get("/api/tss/tournament/24839/matches") m = r.json()["matches"][0] assert m["round"] is None assert m["position"] is None assert m["session_ids"] == ["6cbc20b001de1ee"] def test_tournament_standings(client): r = client.get("/api/tss/tournament/24839/standings") assert r.json()["standings"][0]["rank"] == 1