diff --git a/backend/app/app/conftest.py b/backend/app/app/conftest.py index 0042802..af5d244 100644 --- a/backend/app/app/conftest.py +++ b/backend/app/app/conftest.py @@ -3,6 +3,7 @@ from sqlmodel import Session, SQLModel, create_engine from app.core.config import settings +from app.db.init_db import init_db from app.web.api.deps import get_db from app.web.application import get_app @@ -13,7 +14,9 @@ def session_fixture(): f"postgresql+psycopg://{settings.POSTGRES_USER}:{settings.POSTGRES_PASSWORD}@bemore-db/{settings.POSTGRES_DB}", ) SQLModel.metadata.create_all(engine) + with Session(engine) as session: + init_db(session) yield session @@ -38,30 +41,3 @@ def get_session_override(): client = AsyncClient(app=app, base_url="http://localhost:8000") yield client app.dependency_overrides.clear() - - -# @pytest.fixture() -# def fastapi_app() -> FastAPI: -# """ -# Fixture for creating FastAPI app. - -# :return: fastapi app with mocked dependencies. -# """ -# application = get_app() -# return application # noqa: WPS331 - - -# @pytest.fixture(name="client") -# async def client_fixture( -# fastapi_app: FastAPI, -# ) -> AsyncGenerator[AsyncClient, None]: -# """ -# Fixture that creates client for requesting server. - -# :param fastapi_app: the application. -# :yield: client for the app. -# """ -# async with AsyncClient( -# app=fastapi_app, base_url="http://localhost:8000" -# ) as ac: -# yield ac