Add tests for poll creation

This commit is contained in:
Thomas Sileo 2022-07-25 08:14:34 +02:00
parent 4d0f439c8c
commit c8bd23b696
2 changed files with 140 additions and 4 deletions

View file

@ -24,10 +24,12 @@ async def async_db_session():
@pytest.fixture
def db() -> Generator:
Base.metadata.create_all(bind=engine)
try:
yield _Session
finally:
Base.metadata.drop_all(bind=engine)
with _Session() as db_session:
try:
yield db_session
finally:
db_session.close()
Base.metadata.drop_all(bind=engine)
@pytest.fixture