Files
nuzlocke-tracker/backend/tests/test_smoke.py
Julian Tabel b0ac3714a9 Set up backend test infrastructure
Add pytest fixtures (engine, db_session, client) with session-scoped
event loop to avoid asyncpg loop mismatch errors. Smoke tests verify
all three main API endpoints return empty results on a clean DB.
Test DB provided by docker-compose.test.yml on port 5433.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 12:35:22 +01:00

32 lines
1.1 KiB
Python

"""Smoke tests that verify the test infrastructure is working correctly."""
async def test_games_endpoint_returns_empty_list(client):
"""Games endpoint returns an empty list on a clean database."""
response = await client.get("/api/v1/games")
assert response.status_code == 200
assert response.json() == []
async def test_runs_endpoint_returns_empty_list(client):
"""Runs endpoint returns an empty list on a clean database."""
response = await client.get("/api/v1/runs")
assert response.status_code == 200
assert response.json() == []
async def test_pokemon_endpoint_returns_empty_list(client):
"""Pokemon endpoint returns paginated empty result on a clean database."""
response = await client.get("/api/v1/pokemon")
assert response.status_code == 200
data = response.json()
assert data["items"] == []
assert data["total"] == 0
async def test_database_isolation_between_tests(client):
"""Confirm state from previous tests does not leak into this one."""
response = await client.get("/api/v1/games")
assert response.status_code == 200
assert response.json() == []