aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/conftest.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py
index a2b562e..9660c32 100644
--- a/tests/unit/conftest.py
+++ b/tests/unit/conftest.py
@@ -8,20 +8,25 @@ import pytest
from gn3.app import create_app
@pytest.fixture(scope="session")
-def client():
- """Create a test client fixture for tests"""
+def test_app():
# Do some setup
with TemporaryDirectory() as testdir:
testdb = Path(testdir).joinpath(
f'testdb_{datetime.now().strftime("%Y%m%dT%H%M%S")}')
- app = create_app({"AUTH_DB": testdb})
- app.config.update({"TESTING": True})
+ app = create_app()
+ app.config.update({"TESTING": True, "AUTH_DB": testdb})
app.testing = True
- yield app.test_client()
+ yield app
# Clean up after ourselves
testdb.unlink(missing_ok=True)
@pytest.fixture(scope="session")
+def client(test_app):
+ """Create a test client fixture for tests"""
+ with test_app.app_context():
+ yield test_app.test_client()
+
+@pytest.fixture(scope="session")
def test_app_config(client): # pylint: disable=redefined-outer-name
"""Return the test application's configuration object"""
return client.application.config