Document task DB access and unify background task DB handling
This commit is contained in:
@@ -34,6 +34,7 @@ def _make_app(flush_count: int = 0) -> MagicMock:
|
||||
app.state.db.close = AsyncMock()
|
||||
app.state.scheduler = MagicMock()
|
||||
app.state.settings = MagicMock(database_path="/tmp/fake.db")
|
||||
app.state.runtime_settings = None
|
||||
return app
|
||||
|
||||
|
||||
@@ -51,7 +52,7 @@ class TestRunFlush:
|
||||
app = _make_app()
|
||||
|
||||
with patch(
|
||||
"app.tasks.geo_cache_flush.open_db",
|
||||
"app.tasks.db.open_db",
|
||||
new_callable=AsyncMock,
|
||||
return_value=app.state.db,
|
||||
), patch(
|
||||
@@ -69,7 +70,7 @@ class TestRunFlush:
|
||||
app = _make_app()
|
||||
|
||||
with patch(
|
||||
"app.tasks.geo_cache_flush.open_db",
|
||||
"app.tasks.db.open_db",
|
||||
new_callable=AsyncMock,
|
||||
return_value=app.state.db,
|
||||
), patch(
|
||||
@@ -89,7 +90,7 @@ class TestRunFlush:
|
||||
app = _make_app()
|
||||
|
||||
with patch(
|
||||
"app.tasks.geo_cache_flush.open_db",
|
||||
"app.tasks.db.open_db",
|
||||
new_callable=AsyncMock,
|
||||
return_value=app.state.db,
|
||||
), patch(
|
||||
|
||||
Reference in New Issue
Block a user