Files
wordsearch/tests/conftest.py
T
Mathew Sir Guest the bestandClaude Opus 4.6 cd1dc9200b fix: harden API, add rate limiting, disable debug by default
- Add input validation and error handling across all API endpoints
  (malformed JSON, missing fields, invalid types return proper 4xx)
- Add per-IP rate limiting (10/min new games, 60/min other requests)
- Add session rollback on unhandled exceptions
- Default debug=False, add --debug CLI flag to opt in
- Frontend: add fetch error handling, fix feedback timeout stacking,
  disable buttons during requests, allow clicking found cells for
  overlapping word selection
- Expand seed data to 7 categories with 25-35 words each

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-07 00:59:47 -06:00

40 lines
852 B
Python

import pytest
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_engine():
engine = create_engine("sqlite:///:memory:")
Base.metadata.create_all(engine)
yield engine
engine.dispose()
@pytest.fixture
def db_session(db_engine):
Session = sessionmaker(bind=db_engine)
session = Session()
yield session
session.close()
@pytest.fixture(autouse=True)
def clear_rate_limits():
from handlers.api import _rate_buckets
_rate_buckets.clear()
@pytest.fixture
def app(db_engine):
from app import make_app
Session = sessionmaker(bind=db_engine)
application = make_app(session_factory=Session)
return application