- Add pytest config with 90% coverage threshold - 15 test files covering all routers, services, schemas, models - 300 tests: unit tests, integration tests, edge cases, mocked external APIs - Update CI workflow to run pytest with coverage enforcement - Mock external services (Genius, MusicBrainz, RadioBrowser) - In-memory SQLite DB per test via conftest fixtures
22 lines
592 B
Python
22 lines
592 B
Python
"""Router tests - Health, CORS, Middleware."""
|
|
|
|
|
|
class TestHealth:
|
|
def test_health(self, client):
|
|
r = client.get("/health")
|
|
assert r.status_code == 200
|
|
assert r.json()["status"] == "ok"
|
|
|
|
|
|
class TestNotFound:
|
|
def test_unknown_route(self, client):
|
|
r = client.get("/api/nonexistent")
|
|
assert r.status_code == 404
|
|
|
|
|
|
class TestCORS:
|
|
def test_cors_headers(self, client):
|
|
r = client.get("/api/songs", headers={"Origin": "http://localhost:5173"})
|
|
assert r.status_code == 200
|
|
assert "access-control-allow-origin" in r.headers
|