commit 89cca4cc057c8e428afe7c245b2940261fa31302
parent cccf96bcfbaa1769c6a9acaa996905a63b3e54a9
Author: Chris Roberts <chris.roberts@learningunix.net>
Date: Tue, 14 Jul 2026 05:05:08 -0500
Wire jobs.toml into the app factory via dependency injection
create_app accepts an optional jobs dict rather than always
loading jobs.toml itself, so tests can inject fake job data
directly (see tests/conftest.py) instead of depending on a
real config file on disk. Falls back to the real load_jobs()
call when nothing is passed, so `flask run` is unaffected.
Adds GET /jobs as a minimal proof the injected/loaded data is
actually reachable from a running app.
Diffstat:
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
@@ -0,0 +1,15 @@
+import pytest
+
+from simplefe.app import create_app
+
+
+@pytest.fixture()
+def app():
+ app = create_app(jobs={"rip": {"path": "/fake/path"}})
+ app.config.update({"TESTING": True})
+ yield app
+
+
+@pytest.fixture()
+def client(app):
+ return app.test_client()
diff --git a/tests/test_app.py b/tests/test_app.py
@@ -0,0 +1,3 @@
+def test_list_jobs(client):
+ response = client.get("/jobs")
+ assert response.json == {"jobs": ["rip"]}