Skip to content

Commit 22d5a42

Browse files
committed
test: update BookStack connector test to disable deprecated indexing
1 parent 505bc64 commit 22d5a42

1 file changed

Lines changed: 6 additions & 18 deletions

File tree

surfsense_backend/tests/unit/tasks/celery_tasks/test_schedule_checker_task.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _due_connector(connector_type: SearchSourceConnectorType) -> SimpleNamespace
5959
return SimpleNamespace(
6060
id=42,
6161
connector_type=connector_type,
62-
search_space_id=7,
62+
workspace_id=7,
6363
user_id="00000000-0000-0000-0000-000000000001",
6464
config={},
6565
periodic_indexing_enabled=True,
@@ -86,13 +86,8 @@ async def _session_ctx():
8686

8787

8888
@pytest.mark.asyncio
89-
async def test_due_bookstack_connector_dispatches_indexing_task(monkeypatch):
90-
"""A due BookStack connector must dispatch index_bookstack_pages_task.
91-
92-
Regression test for the connector type missing from the scheduler's
93-
task_map, which made periodic BookStack syncs silently no-op with only a
94-
"No task found" warning.
95-
"""
89+
async def test_due_bookstack_connector_disables_deprecated_indexing(monkeypatch):
90+
"""A due BookStack connector is retired from periodic indexing, not dispatched."""
9691
from app.tasks.celery_tasks import connector_tasks
9792

9893
task_mock = MagicMock()
@@ -101,16 +96,9 @@ async def test_due_bookstack_connector_dispatches_indexing_task(monkeypatch):
10196
connector = _due_connector(SearchSourceConnectorType.BOOKSTACK_CONNECTOR)
10297
session = await _run_checker(monkeypatch, connector)
10398

104-
task_mock.delay.assert_called_once_with(
105-
connector.id,
106-
connector.search_space_id,
107-
str(connector.user_id),
108-
None,
109-
None,
110-
)
111-
# The next run must be rescheduled, otherwise the connector stays "due"
112-
# and is re-examined every minute.
113-
assert connector.next_scheduled_at > datetime.now(UTC)
99+
task_mock.delay.assert_not_called()
100+
assert connector.periodic_indexing_enabled is False
101+
assert connector.next_scheduled_at is None
114102
assert session.commits == 1
115103

116104

0 commit comments

Comments
 (0)