- 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
18 lines
439 B
Python
18 lines
439 B
Python
"""Database tests."""
|
|
|
|
|
|
class TestDatabase:
|
|
def test_init_db_creates_tables(self, db_module):
|
|
from app.db.database import init_db
|
|
init_db() # Should not raise
|
|
|
|
def test_get_db_yields_and_closes(self, db_module):
|
|
gen = db_module.get_db()
|
|
session = next(gen)
|
|
assert session is not None
|
|
session.close()
|
|
try:
|
|
next(gen)
|
|
except StopIteration:
|
|
pass
|