~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
test(api): fix stale analyze_documents REST tests (#4744)
LearningCircuit3ff45f7cf74c
diff --git a/tests/api_tests/test_all_endpoints.py b/tests/api_tests/test_all_endpoints.pyindex a54f2649a7..dfe9b3b22c 100644--- a/tests/api_tests/test_all_endpoints.py+++ b/tests/api_tests/test_all_endpoints.py@@ -378,9 +378,9 @@ class TestAllEndpoints:f"Generate report status: {response.status_code}")- # Analyze documents+ # Analyze documents. The endpoint searches a named local collection;+ # it does not accept an inline "documents" key (that now yields a 400).doc_data = {- "documents": ["test document content"],"query": "Summarize this document","collection_name": "test_collection",}diff --git a/tests/api_tests/test_rest_api.py b/tests/api_tests/test_rest_api.pyindex 62c6f55bb5..b877dd9695 100644--- a/tests/api_tests/test_rest_api.py+++ b/tests/api_tests/test_rest_api.py@@ -80,9 +80,20 @@ class TestRestAPI:print("✅ Quick summary validation passed")- @pytest.mark.requires_llm- def test_analyze_documents_minimal(self, authenticated_client):- """Test analyze documents with minimal input."""+ def test_analyze_documents_rejects_inline_documents(+ self, authenticated_client+ ):+ """``/api/v1/analyze_documents`` searches a *named local collection*;+ it does not accept inline ``documents``.++ The endpoint validates request-body keys against the real+ ``analyze_documents`` signature (``web/api.py``) and rejects unknown+ keys with a clear 400 *before* any LLM call, so this needs no real LLM.+ Previously this test posted an unsupported ``documents`` key and+ asserted a 200 with an ``analysis``/``processed_documents`` body that+ the endpoint never returns (the real shape is+ ``{summary, documents, collection, document_count}``).+ """payload = {"documents": ["Python is a programming language."],"query": "What is Python?",@@ -95,15 +106,17 @@ class TestRestAPI:content_type="application/json",)- assert response.status_code == 200+ # Unsupported "documents" key -> clear 400 (not an opaque 500).+ assert response.status_code == 400data = json.loads(response.data)-- # Verify response structure- assert "analysis" in data- assert "processed_documents" in data- assert data["processed_documents"] == 1-- print("✅ Analyze documents passed")+ # The rejected key is named *as the offender* (after the colon) — not+ # merely a substring of "analyze_documents" in the message prefix.+ offenders = data["error"].split(":", 1)[1]+ assert "documents" in offenders+ assert "documents" not in data["allowed_parameters"]+ assert "max_results" in data["allowed_parameters"]++ print("✅ Analyze documents rejects inline documents")def test_analyze_documents_validation(self, authenticated_client):"""Test analyze documents endpoint validation."""diff --git a/tests/api_tests/test_rest_api_simple.py b/tests/api_tests/test_rest_api_simple.pyindex 97a73ebdea..2f35cf7fe9 100644--- a/tests/api_tests/test_rest_api_simple.py+++ b/tests/api_tests/test_rest_api_simple.py@@ -101,36 +101,6 @@ class TestRestAPISimple:)print(f" Response: {response.data[:200]}")- @pytest.mark.requires_llm- def test_analyze_documents_minimal(self, authenticated_client):- """Test analyze documents with minimal input."""- print("🔍 Testing analyze documents with minimal input...")-- payload = {- "documents": ["The cat sat on the mat."],- "query": "Where is the cat?",- "collection_name": "test_minimal",- }-- response = authenticated_client.post(- "/api/v1/analyze_documents",- json=payload,- content_type="application/json",- )-- if response.status_code == 200:- data = json.loads(response.data)-- # Basic structure validation- assert "analysis" in data- assert "processed_documents" in data- assert data["processed_documents"] == 1-- print("✅ Analyze documents passed")- else:- # This endpoint might not be fully implemented- print(f"⚠️ Analyze documents returned {response.status_code}")-@pytest.mark.requires_llmdef test_generate_report_minimal(self, authenticated_client):"""Test generate report with minimal input."""