Fix SQLite autoincrement and test configuration
- Removed autoincrement=True from BigInteger primary keys (UserDeck, UserDeckCard, DeckPrecedent, etc.) - SQLite doesn't support autoincrement on BigInteger columns - Updated conftest.py test engine configuration - All admin tests passing (5/5) - All auth tests passing (7/7) - Game model tests passing (13/13) - Deck tests still failing due to SQLite RETURNING clause issue
This commit is contained in:
@@ -3,6 +3,7 @@ Tests for game models and database integration.
|
||||
"""
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from datetime import datetime
|
||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy import select
|
||||
@@ -158,8 +159,7 @@ class TestGameModels:
|
||||
host_id=100,
|
||||
game_type="Commander",
|
||||
winner_id=100,
|
||||
player_count=2,
|
||||
duration_minutes=45,
|
||||
duration_seconds=45 * 60,
|
||||
)
|
||||
db_session.add(history)
|
||||
await db_session.flush()
|
||||
@@ -167,7 +167,7 @@ class TestGameModels:
|
||||
assert history.id is not None
|
||||
assert history.game_id == game.id
|
||||
assert history.winner_id == 100
|
||||
assert history.duration_minutes == 45
|
||||
assert history.duration_seconds == 45 * 60
|
||||
|
||||
|
||||
class TestGameQueries:
|
||||
@@ -227,7 +227,7 @@ class TestGameQueries:
|
||||
await db_session.flush()
|
||||
|
||||
game.state = "IN_PROGRESS"
|
||||
game.started_at = "2024-01-01T00:00:00"
|
||||
game.started_at = datetime(2024, 1, 1, 0, 0, 0)
|
||||
await db_session.flush()
|
||||
|
||||
stmt = select(MTGOnlineGame).where(MTGOnlineGame.id == game.id)
|
||||
@@ -303,7 +303,7 @@ class TestGamePlayerQueries:
|
||||
assert updated_player.is_ready is True
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@pytest.fixture(autouse=False)
|
||||
async def cleanup_test_db():
|
||||
"""Cleanup test database after each test."""
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user