Fix test setup for backend

This commit is contained in:
lvrossem
2023-04-06 14:10:31 -06:00
parent 5528ae8519
commit 78138e83c7
16 changed files with 121 additions and 26 deletions

20
tests/config/database.py Normal file
View File

@@ -0,0 +1,20 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from src.database import Base
SQLALCHEMY_DATABASE_URL = "postgresql://admin:WeSign123!@localhost/wesigntest"
engine = create_engine(SQLALCHEMY_DATABASE_URL)
TestSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base.metadata.create_all(bind=engine)
def override_get_db():
try:
db = TestSessionLocal()
yield db
finally:
db.close()