fix: make auth tests pass with initial data setup
This commit is contained in:
@@ -450,3 +450,13 @@ INFO: Waiting for application startup.
|
|||||||
INFO: Application startup complete.
|
INFO: Application startup complete.
|
||||||
MinIO init warning: HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /pdg-files?location= (Caused by NewConnectionError("HTTPConnection(host='localhost', port=9000): Failed to establish a new connection: [Errno 61] Connection refused"))
|
MinIO init warning: HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /pdg-files?location= (Caused by NewConnectionError("HTTPConnection(host='localhost', port=9000): Failed to establish a new connection: [Errno 61] Connection refused"))
|
||||||
INFO: 127.0.0.1:50646 - "GET /health HTTP/1.1" 200 OK
|
INFO: 127.0.0.1:50646 - "GET /health HTTP/1.1" 200 OK
|
||||||
|
WARNING: WatchFiles detected changes in 'tests/test_auth.py'. Reloading...
|
||||||
|
INFO: Shutting down
|
||||||
|
INFO: Waiting for application shutdown.
|
||||||
|
INFO: Application shutdown complete.
|
||||||
|
INFO: Finished server process [35542]
|
||||||
|
/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
|
||||||
|
warnings.warn(
|
||||||
|
INFO: Started server process [35866]
|
||||||
|
INFO: Waiting for application startup.
|
||||||
|
INFO: Application startup complete.
|
||||||
|
|||||||
@@ -3,9 +3,13 @@ from fastapi.testclient import TestClient
|
|||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import sessionmaker
|
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.main import app
|
||||||
from app.core.database import Base, get_db
|
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
|
# Use SQLite for testing
|
||||||
SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db"
|
SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db"
|
||||||
@@ -28,6 +32,10 @@ client = TestClient(app)
|
|||||||
@pytest.fixture(scope="module", autouse=True)
|
@pytest.fixture(scope="module", autouse=True)
|
||||||
def setup_db():
|
def setup_db():
|
||||||
Base.metadata.create_all(bind=engine)
|
Base.metadata.create_all(bind=engine)
|
||||||
|
db = TestingSessionLocal()
|
||||||
|
create_initial_data(db)
|
||||||
|
init_builtin_data(db)
|
||||||
|
db.close()
|
||||||
yield
|
yield
|
||||||
Base.metadata.drop_all(bind=engine)
|
Base.metadata.drop_all(bind=engine)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user