fix: make auth tests pass with initial data setup
This commit is contained in:
@@ -3,9 +3,13 @@ from fastapi.testclient import TestClient
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
import sys
|
||||
sys.path.insert(0, '/Users/nathan/Work/DataPointer/prop-data-guard/backend')
|
||||
|
||||
from app.main import app
|
||||
from app.core.database import Base, get_db
|
||||
from app.core.config import settings
|
||||
from app.services.user_service import create_initial_data
|
||||
from app.services.classification_service import init_builtin_data
|
||||
|
||||
# Use SQLite for testing
|
||||
SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db"
|
||||
@@ -28,6 +32,10 @@ client = TestClient(app)
|
||||
@pytest.fixture(scope="module", autouse=True)
|
||||
def setup_db():
|
||||
Base.metadata.create_all(bind=engine)
|
||||
db = TestingSessionLocal()
|
||||
create_initial_data(db)
|
||||
init_builtin_data(db)
|
||||
db.close()
|
||||
yield
|
||||
Base.metadata.drop_all(bind=engine)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user