music-app/backend/tests/test_routers_misc.py
Jarian Cottingham 24c03426f8 test: add comprehensive test suite with 94% coverage
- 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
2026-07-06 06:07:31 +00:00

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