feat: add REST API for categories, game creation, and guessing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
c1f7ed44c1
commit
7c3a8f22cf
+19
-3
@@ -3,14 +3,30 @@ from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from models import Base
|
||||
from models.category import Category, CategoryWord # noqa: F401
|
||||
from models.game import Game, Word # noqa: F401
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def db_session():
|
||||
def db_engine():
|
||||
engine = create_engine("sqlite:///:memory:")
|
||||
Base.metadata.create_all(engine)
|
||||
Session = sessionmaker(bind=engine)
|
||||
yield engine
|
||||
engine.dispose()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def db_session(db_engine):
|
||||
Session = sessionmaker(bind=db_engine)
|
||||
session = Session()
|
||||
yield session
|
||||
session.close()
|
||||
engine.dispose()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app(db_engine):
|
||||
from app import make_app
|
||||
|
||||
Session = sessionmaker(bind=db_engine)
|
||||
application = make_app(session_factory=Session)
|
||||
return application
|
||||
|
||||
Reference in New Issue
Block a user