Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: update tests broken by server-side pagination and PDF storage changes (#3396)

LearningCircuitc11067a2bbb1
diff --git a/tests/auth_tests/test_auth_routes.py b/tests/auth_tests/test_auth_routes.py
index a2ff0acc2e..3f96753a9d 100644
--- a/tests/auth_tests/test_auth_routes.py
+++ b/tests/auth_tests/test_auth_routes.py
@@ -10,6 +10,7 @@ from pathlib import Path
import pytest
from local_deep_research.database.auth_db import (
+ dispose_auth_engine,
get_auth_db_session,
init_auth_database,
)
@@ -23,7 +24,7 @@ def temp_data_dir():
"""Create a temporary data directory for testing."""
temp_dir = tempfile.mkdtemp()
yield Path(temp_dir)
- shutil.rmtree(temp_dir)
+ shutil.rmtree(temp_dir, ignore_errors=True)
@pytest.fixture
@@ -65,6 +66,7 @@ def app(temp_data_dir, monkeypatch):
# Cleanup after test
db_manager.close_all_databases()
+ dispose_auth_engine()
@pytest.fixture
diff --git a/tests/research_library/routes/test_library_routes_coverage.py b/tests/research_library/routes/test_library_routes_coverage.py
index 1463d22b63..35f1bdba23 100644
--- a/tests/research_library/routes/test_library_routes_coverage.py
+++ b/tests/research_library/routes/test_library_routes_coverage.py
@@ -151,6 +151,10 @@ def _auth_client(
f"{_ROUTES}.get_authenticated_user_password",
return_value=get_auth_password,
),
+ patch(
+ "local_deep_research.database.library_init.get_default_library_id",
+ return_value=None,
+ ),
]
started = []
@@ -244,6 +248,7 @@ class TestLibraryPage:
lib_svc.get_unique_domains.return_value = ["arxiv.org"]
lib_svc.get_research_list_for_dropdown.return_value = []
lib_svc.get_all_collections.return_value = []
+ lib_svc.count_documents.return_value = 1
with _auth_client(app, library_service=lib_svc) as (client, mocks):
resp = client.get("/library/")
@@ -260,6 +265,7 @@ class TestLibraryPage:
lib_svc.get_unique_domains.return_value = []
lib_svc.get_research_list_for_dropdown.return_value = []
lib_svc.get_all_collections.return_value = []
+ lib_svc.count_documents.return_value = 0
with _auth_client(app, library_service=lib_svc) as (client, mocks):
resp = client.get(
@@ -271,6 +277,7 @@ class TestLibraryPage:
domain="arxiv.org",
collection_id="c1",
limit=100,
+ offset=0,
)
def test_pdf_storage_none_disables_button(self, app):
@@ -280,6 +287,7 @@ class TestLibraryPage:
lib_svc.get_unique_domains.return_value = []
lib_svc.get_research_list_for_dropdown.return_value = []
lib_svc.get_all_collections.return_value = []
+ lib_svc.count_documents.return_value = 0
with _auth_client(
app,
diff --git a/tests/research_library/routes/test_library_routes_deep_coverage.py b/tests/research_library/routes/test_library_routes_deep_coverage.py
index c2c5bb30eb..a71e01ceb1 100644
--- a/tests/research_library/routes/test_library_routes_deep_coverage.py
+++ b/tests/research_library/routes/test_library_routes_deep_coverage.py
@@ -120,6 +120,10 @@ def _auth_client(
f"{_ROUTES}.get_authenticated_user_password",
return_value=get_auth_password,
),
+ patch(
+ "local_deep_research.database.library_init.get_default_library_id",
+ return_value=None,
+ ),
]
if extra_patches:
patches.extend(extra_patches)
@@ -397,6 +401,7 @@ class TestGetDocumentsPagination:
lib_svc.get_unique_domains.return_value = []
lib_svc.get_research_list_for_dropdown.return_value = []
lib_svc.get_all_collections.return_value = []
+ lib_svc.count_documents.return_value = 0
with _auth_client(app, library_service=lib_svc) as (client, _):
client.get("/library/?collection=col-42")
lib_svc.get_documents.assert_called_once_with(
@@ -404,6 +409,7 @@ class TestGetDocumentsPagination:
domain=None,
collection_id="col-42",
limit=100,
+ offset=0,
)
diff --git a/tests/research_library/routes/test_library_routes_view_coverage.py b/tests/research_library/routes/test_library_routes_view_coverage.py
index 33a5cc9cd7..cccd04095d 100644
--- a/tests/research_library/routes/test_library_routes_view_coverage.py
+++ b/tests/research_library/routes/test_library_routes_view_coverage.py
@@ -131,6 +131,10 @@ def _auth_client(
f"{_ROUTES}.get_authenticated_user_password",
return_value=get_auth_password,
),
+ patch(
+ "local_deep_research.database.library_init.get_default_library_id",
+ return_value=None,
+ ),
]
if extra_patches:
patches.extend(extra_patches)
@@ -178,6 +182,7 @@ class TestLibraryPageWithFilters:
lib_svc.get_unique_domains.return_value = ["arxiv.org"]
lib_svc.get_research_list_for_dropdown.return_value = []
lib_svc.get_all_collections.return_value = []
+ lib_svc.count_documents.return_value = 0
with _auth_client(app, library_service=lib_svc) as (client, ctx):
resp = client.get("/library/?domain=arxiv.org")
@@ -188,6 +193,7 @@ class TestLibraryPageWithFilters:
domain="arxiv.org",
collection_id=None,
limit=100,
+ offset=0,
)
def test_library_page_with_research_filter(self, app):
@@ -197,6 +203,7 @@ class TestLibraryPageWithFilters:
lib_svc.get_unique_domains.return_value = []
lib_svc.get_research_list_for_dropdown.return_value = []
lib_svc.get_all_collections.return_value = []
+ lib_svc.count_documents.return_value = 0
with _auth_client(app, library_service=lib_svc) as (client, ctx):
resp = client.get("/library/?research=42")
@@ -207,6 +214,7 @@ class TestLibraryPageWithFilters:
domain=None,
collection_id=None,
limit=100,
+ offset=0,
)
def test_library_page_with_collection_filter(self, app):
@@ -216,6 +224,7 @@ class TestLibraryPageWithFilters:
lib_svc.get_unique_domains.return_value = []
lib_svc.get_research_list_for_dropdown.return_value = []
lib_svc.get_all_collections.return_value = []
+ lib_svc.count_documents.return_value = 0
with _auth_client(app, library_service=lib_svc) as (client, ctx):
resp = client.get("/library/?collection=99")
@@ -226,6 +235,7 @@ class TestLibraryPageWithFilters:
domain=None,
collection_id="99",
limit=100,
+ offset=0,
)
# Render call includes selected_collection
render_call_kwargs = ctx["render"].call_args[1]
@@ -238,6 +248,7 @@ class TestLibraryPageWithFilters:
lib_svc.get_unique_domains.return_value = []
lib_svc.get_research_list_for_dropdown.return_value = []
lib_svc.get_all_collections.return_value = []
+ lib_svc.count_documents.return_value = 0
with _auth_client(app, library_service=lib_svc) as (client, _):
resp = client.get("/library/")
@@ -248,6 +259,7 @@ class TestLibraryPageWithFilters:
domain=None,
collection_id=None,
limit=100,
+ offset=0,
)
diff --git a/tests/web_search_engines/engines/test_local_search_coverage.py b/tests/web_search_engines/engines/test_local_search_coverage.py
index 78e3c44c92..2a81c7b10e 100644
--- a/tests/web_search_engines/engines/test_local_search_coverage.py
+++ b/tests/web_search_engines/engines/test_local_search_coverage.py
@@ -557,7 +557,7 @@ class TestDocumentURL:
rag_svc.return_value.__enter__.return_value = rag_inst
rag_svc.return_value.__exit__.return_value = None
- pdf_mgr.return_value.has_pdf.return_value = has_pdf
+ pdf_mgr.pdf_exists.return_value = has_pdf
results = engine.search("q")