2a9ebe24: Implement auth endpoints (register/login/JWT) with SQLAlchemy
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
"""Pytest configuration and fixtures."""
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.orm import sessionmaker, Session
|
||||
from sqlalchemy.pool import StaticPool
|
||||
|
||||
from app.main import app
|
||||
@@ -22,8 +21,11 @@ TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engin
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def db_session():
|
||||
def db_session() -> Session:
|
||||
"""Create a fresh database for each test."""
|
||||
# Import models to ensure they're registered with Base
|
||||
from app.models.user import User # noqa: F401
|
||||
|
||||
Base.metadata.create_all(bind=engine)
|
||||
db = TestingSessionLocal()
|
||||
try:
|
||||
@@ -34,7 +36,7 @@ def db_session():
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def client(db_session):
|
||||
def client(db_session: Session) -> TestClient:
|
||||
"""Create a test client with fresh database."""
|
||||
|
||||
def override_get_db():
|
||||
|
||||
Reference in New Issue
Block a user