~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix: align tests with current safe_requests and warning_checks behavior (#2659)
LearningCircuit4a3c9dbecf3b
diff --git a/tests/security/test_check_response_size.py b/tests/security/test_check_response_size.pyindex 8ab43e0a69..06bb6a3435 100644--- a/tests/security/test_check_response_size.py+++ b/tests/security/test_check_response_size.py@@ -24,6 +24,9 @@ def _mock_response(status_code=200, headers=None):resp.status_code = status_coderesp.headers = headers or {}resp.url = "https://example.com"+ # _check_response_size may install a body guard via _install_body_guard,+ # which accesses response.raw.read+ resp.raw = MagicMock()return resp@@ -104,10 +107,10 @@ def _bypass_ssrf():class TestSendIntermediateRedirectBranching:"""Tests for is_intermediate_redirect logic (lines 437-443)."""- def test_302_with_location_and_allow_redirects_skips_size_check(+ def test_302_with_location_and_allow_redirects_applies_size_check(self, _bypass_ssrf):- """302 + Location + allow_redirects=True → skip size check (oversized OK)."""+ """302 + Location + allow_redirects=True → size check still applies."""oversized = _mock_response(302,{@@ -117,8 +120,8 @@ class TestSendIntermediateRedirectBranching:)session = SafeSession()with patch.object(requests.Session, "send", return_value=oversized):- result = session.send(_prep_request(), allow_redirects=True)- assert result.status_code == 302+ with pytest.raises(ValueError, match="Response too large"):+ session.send(_prep_request(), allow_redirects=True)def test_302_with_location_and_allow_redirects_false_applies_size_check(self, _bypass_ssrf@@ -173,10 +176,10 @@ class TestSendIntermediateRedirectBranching:session.send(_prep_request())@pytest.mark.parametrize("status_code", [301, 302, 303, 307, 308])- def test_all_redirect_codes_skip_size_check(+ def test_all_redirect_codes_apply_size_check(self, _bypass_ssrf, status_code):- """All 5 redirect codes + Location + allow_redirects=True → skip size check."""+ """All 5 redirect codes + Location + oversized → rejected by size check."""oversized = _mock_response(status_code,{@@ -186,11 +189,13 @@ class TestSendIntermediateRedirectBranching:)session = SafeSession()with patch.object(requests.Session, "send", return_value=oversized):- result = session.send(_prep_request(), allow_redirects=True)- assert result.status_code == status_code+ with pytest.raises(ValueError, match="Response too large"):+ session.send(_prep_request(), allow_redirects=True)- def test_allow_redirects_defaults_to_true(self, _bypass_ssrf):- """No allow_redirects in kwargs → defaults to True → skip size check."""+ def test_allow_redirects_defaults_to_true_still_checks_size(+ self, _bypass_ssrf+ ):+ """No allow_redirects in kwargs → size check still applies."""oversized = _mock_response(302,{@@ -200,9 +205,8 @@ class TestSendIntermediateRedirectBranching:)session = SafeSession()with patch.object(requests.Session, "send", return_value=oversized):- # No allow_redirects kwarg at all- result = session.send(_prep_request())- assert result.status_code == 302+ with pytest.raises(ValueError, match="Response too large"):+ session.send(_prep_request())def test_304_not_in_redirect_set_applies_size_check(self, _bypass_ssrf):"""304 Not Modified is NOT in the redirect frozenset → size check applies."""@@ -219,11 +223,10 @@ class TestSendIntermediateRedirectBranching:with pytest.raises(ValueError, match="Response too large"):session.send(_prep_request(), allow_redirects=True)- def test_oversized_intermediate_redirect_not_rejected(self, _bypass_ssrf):- """301 + Location + allow_redirects=True + oversized → no raise.+ def test_oversized_intermediate_redirect_rejected(self, _bypass_ssrf):+ """301 + Location + allow_redirects=True + oversized → raises.- This validates the security design: intermediate redirects are not- size-checked because their body is discarded during redirect following.+ All responses are size-checked uniformly, including redirects."""oversized = _mock_response(301,@@ -234,5 +237,5 @@ class TestSendIntermediateRedirectBranching:)session = SafeSession()with patch.object(requests.Session, "send", return_value=oversized):- result = session.send(_prep_request(), allow_redirects=True)- assert result.status_code == 301+ with pytest.raises(ValueError, match="Response too large"):+ session.send(_prep_request(), allow_redirects=True)diff --git a/tests/web/warning_checks/test_orchestrator.py b/tests/web/warning_checks/test_orchestrator.pyindex ead4e4986e..dd41c4ecc1 100644--- a/tests/web/warning_checks/test_orchestrator.py+++ b/tests/web/warning_checks/test_orchestrator.py@@ -389,14 +389,18 @@ class TestCalculateWarningsLegacyServerConfig:"""Orchestrator coverage for the legacy_server_config check."""def test_legacy_server_config_warning_when_file_exists(self):- """If server_config.json exists on disk, warning appears in output."""+ """If server_config.json exists on disk with non-default values, warning appears."""from local_deep_research.web.warning_checks import calculate_warningsmgr = _make_settings_manager()+ mock_path = Mock()+ mock_path.exists.return_value = True+ # Provide JSON with a non-default value so the warning fires+ mock_path.read_text.return_value = '{"port": 9999}'with _patch_orchestrator(mgr):with patch("local_deep_research.web.server_config.get_server_config_path",- return_value=Mock(exists=Mock(return_value=True)),+ return_value=mock_path,):warnings = calculate_warnings()