flaschengeist/tests/conftest.py

29 lines
564 B
Python

import os
import tempfile
import pytest
from flaschengeist.app import create_app, install_all
@pytest.fixture
def app():
db_fd, db_path = tempfile.mkstemp()
app = create_app(
{
"TESTING": True,
"DATABASE": {"file_path": f"/{db_path}"},
"FLASCHENGEIST": {"auth": "auth_plain"},
"auth_plain": {"enabled": True},
}
)
with app.app_context():
install_all()
yield app
os.close(db_fd)
os.unlink(db_path)
@pytest.fixture
def client(app):
return app.test_client()