[settings] rework settings
This commit is contained in:
@@ -5,7 +5,6 @@ from fastapi.testclient import TestClient
|
||||
from sqlalchemy.pool import StaticPool
|
||||
from sqlmodel import Session, SQLModel, create_engine
|
||||
|
||||
from app.main import app
|
||||
from app.model.models import (
|
||||
AccessAuthorizationDB,
|
||||
Card,
|
||||
@@ -25,6 +24,16 @@ engine = create_engine(
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app():
|
||||
import os
|
||||
|
||||
os.environ["SECRET_KEY"] = "ff" * 16
|
||||
from app.main import app
|
||||
|
||||
return app
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def db_session():
|
||||
"""Create a fresh database session for each test."""
|
||||
@@ -35,7 +44,7 @@ def db_session():
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def client(db_session):
|
||||
def client(app, db_session):
|
||||
"""Create a test client with a database session override."""
|
||||
|
||||
def override_get_session():
|
||||
|
||||
Reference in New Issue
Block a user