Files
TSSBOT/tests/test_tss_api_players.py
T
NotSoToothless 24335a2677 Auto merge dev → main (#1353)
* feat(gateway): hashed key store with grant + hot reload

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(gateway): channel registry + aiohttp app (keyed auth, whoami, per-channel ws/proxy)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(gateway): manage_keys CLI (add/list/revoke)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(gateway): retire srebot_external, run relay-gateway under PM2

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(gateway): point ecosystem + README at relay-gateway

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(tss): replay outbox producer for relay gateway

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(tss): forward processed games to relay outbox

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(tss-api): db helpers, app skeleton, info endpoint, fixtures

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(tss-api): player, games, history, search endpoints

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(tss-api): live, match, scoreboard, matches-search, maps

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(tss-api): filter-required leaderboards (players/vehicles/stats)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(tss-api): tournament list/detail/standings/matches

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat: wire tss upstream through gateway + tssbot-api PM2 app

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 03:38:20 -07:00

38 lines
1.3 KiB
Python

def test_player_summary_and_team_history(client):
r = client.get("/api/tss/player/148919027")
assert r.status_code == 200
body = r.json()
assert body["uid"] == "148919027"
assert body["summary"]["battles"] == 1
assert body["summary"]["wins"] == 1
assert body["summary"]["air_kills"] == 1
assert any(v["vehicle_internal"] == "i-153_m62" for v in body["vehicles"])
assert any(t["team_name"] == "SunThunder" and t["tss_role"] == "captain"
for t in body["team_history"])
assert any(n["nick"] == "Joe" for n in body["nicks"])
def test_player_unknown_is_404(client):
assert client.get("/api/tss/player/000").status_code == 404
def test_player_games_rows(client):
r = client.get("/api/tss/player/148919027/games")
assert r.status_code == 200
rows = r.json()["games"]
assert rows[0]["session_id"] == "sess1"
assert rows[0]["UID"] == "148919027"
def test_player_history_daily(client):
r = client.get("/api/tss/player/148919027/history")
body = r.json()
assert body["days_with_battles_only"] is True
assert body["history"][0]["battles"] == 1
def test_search_by_nick(client):
r = client.get("/api/tss/search/Joe")
hits = r.json()["players"]
assert hits[0]["uid"] == "148919027"