flaschengeist/tests/conftest.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
564 B
Python
Raw Normal View History

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()