~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(tests): narrow broad status-code tautologies in test_benchmark_routes.py (#4137)
LearningCircuit28512aa59716
diff --git a/tests/benchmarks/web_api/test_benchmark_routes.py b/tests/benchmarks/web_api/test_benchmark_routes.pyindex ebddbf5443..041d2406a6 100644--- a/tests/benchmarks/web_api/test_benchmark_routes.py+++ b/tests/benchmarks/web_api/test_benchmark_routes.py@@ -44,7 +44,7 @@ class TestStartBenchmark:)# Without proper auth setup, this will redirect or fail# We're testing the route exists- assert response.status_code in [400, 401, 302, 500]+ assert response.status_code == 401, response.status_codedef test_start_benchmark_empty_datasets_config_returns_400(self):"""Test that empty datasets_config returns 400."""@@ -86,7 +86,7 @@ class TestStartBenchmark:content_type="application/json",)# Will fail auth or validation- assert response.status_code in [400, 401, 302, 500]+ assert response.status_code == 401, response.status_codedef test_start_benchmark_validates_datasets_config(self):"""Test that datasets config with zero counts is rejected."""@@ -106,7 +106,7 @@ class TestStartBenchmark:content_type="application/json",)# Without auth it will redirect- assert response.status_code in [400, 401, 302, 500]+ assert response.status_code == 401, response.status_codedef test_start_benchmark_handles_missing_settings(self):"""Test handling when settings are not found."""@@ -132,7 +132,7 @@ class TestStartBenchmark:content_type="application/json",)# Will fail due to missing auth- assert response.status_code in [400, 401, 302, 500]+ assert response.status_code == 401, response.status_codedef test_start_benchmark_success_returns_benchmark_id(self):"""Test successful benchmark start returns benchmark_run_id."""@@ -281,7 +281,7 @@ class TestValidateConfig:content_type="application/json",)# Without auth will redirect- assert response.status_code in [200, 302, 401, 500]+ assert response.status_code == 401, response.status_codedef test_validate_config_missing_search_tool(self):"""Test that missing search_tool is detected."""@@ -539,7 +539,7 @@ class TestBenchmarkApiRoutes:json={"datasets_config": {"simpleqa": {"count": 5}}},content_type="application/json",)- assert response.status_code in [200, 302, 400, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_start_benchmark_simple_route_exists(self):"""Test /api/start-simple endpoint exists."""@@ -558,7 +558,7 @@ class TestBenchmarkApiRoutes:json={"datasets_config": {"simpleqa": {"count": 5}}},content_type="application/json",)- assert response.status_code in [200, 302, 400, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_get_history_route_exists(self):"""Test /api/history endpoint exists."""@@ -573,7 +573,7 @@ class TestBenchmarkApiRoutes:with app.test_client() as client:response = client.get("/benchmark/api/history")- assert response.status_code in [200, 302, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_get_results_route_exists(self):"""Test /api/results/<run_id> endpoint exists."""@@ -588,7 +588,7 @@ class TestBenchmarkApiRoutes:with app.test_client() as client:response = client.get("/benchmark/api/results/run123")- assert response.status_code in [200, 302, 401, 403, 404, 500]+ assert response.status_code == 404, response.status_codedef test_get_status_route_exists(self):"""Test /api/status/<run_id> endpoint exists."""@@ -603,7 +603,7 @@ class TestBenchmarkApiRoutes:with app.test_client() as client:response = client.get("/benchmark/api/status/run123")- assert response.status_code in [200, 302, 401, 403, 404, 500]+ assert response.status_code == 404, response.status_codedef test_cancel_route_exists(self):"""Test /api/cancel/<run_id> endpoint exists."""@@ -618,7 +618,7 @@ class TestBenchmarkApiRoutes:with app.test_client() as client:response = client.post("/benchmark/api/cancel/run123")- assert response.status_code in [200, 302, 401, 403, 404, 500]+ assert response.status_code == 404, response.status_codedef test_delete_route_exists(self):"""Test /api/delete/<run_id> endpoint exists."""@@ -633,7 +633,7 @@ class TestBenchmarkApiRoutes:with app.test_client() as client:response = client.delete("/benchmark/api/delete/run123")- assert response.status_code in [200, 302, 401, 403, 404, 405, 500]+ assert response.status_code == 404, response.status_codedef test_validate_config_route_exists(self):"""Test /api/validate-config endpoint exists."""@@ -656,7 +656,7 @@ class TestBenchmarkApiRoutes:},content_type="application/json",)- assert response.status_code in [200, 302, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_get_running_route_exists(self):"""Test /api/running endpoint exists."""@@ -671,7 +671,7 @@ class TestBenchmarkApiRoutes:with app.test_client() as client:response = client.get("/benchmark/api/running")- assert response.status_code in [200, 302, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_get_saved_configs_route_exists(self):"""Test /api/configs endpoint exists."""@@ -686,7 +686,7 @@ class TestBenchmarkApiRoutes:with app.test_client() as client:response = client.get("/benchmark/api/configs")- assert response.status_code in [200, 302, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_get_search_quality_route_exists(self):"""Test /api/search-quality/<run_id> endpoint exists."""@@ -701,7 +701,7 @@ class TestBenchmarkApiRoutes:with app.test_client() as client:response = client.get("/benchmark/api/search-quality/run123")- assert response.status_code in [200, 302, 401, 403, 404, 500]+ assert response.status_code == 404, response.status_codeclass TestBenchmarkPageRoutes:@@ -720,7 +720,7 @@ class TestBenchmarkPageRoutes:with app.test_client() as client:response = client.get("/benchmark/")- assert response.status_code in [200, 302, 401, 403, 500]+ assert response.status_code == 500, response.status_codedef test_results_page_route_exists(self):"""Test /results/<run_id> page route exists."""@@ -735,7 +735,7 @@ class TestBenchmarkPageRoutes:with app.test_client() as client:response = client.get("/benchmark/results/run123")- assert response.status_code in [200, 302, 401, 403, 404, 500]+ assert response.status_code == 404, response.status_codeclass TestStartBenchmarkValidation:@@ -763,7 +763,7 @@ class TestStartBenchmarkValidation:},content_type="application/json",)- assert response.status_code in [200, 302, 400, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_start_benchmark_with_run_name(self):"""Test benchmark with custom run name."""@@ -785,7 +785,7 @@ class TestStartBenchmarkValidation:},content_type="application/json",)- assert response.status_code in [200, 302, 400, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_start_benchmark_with_search_settings(self):"""Test benchmark with custom search settings."""@@ -810,7 +810,7 @@ class TestStartBenchmarkValidation:},content_type="application/json",)- assert response.status_code in [200, 302, 400, 401, 403, 500]+ assert response.status_code == 401, response.status_codeclass TestValidateConfigEndpoint:@@ -837,7 +837,7 @@ class TestValidateConfigEndpoint:},content_type="application/json",)- assert response.status_code in [200, 302, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_validate_config_missing_search_tool(self):"""Test validation with missing search_tool."""@@ -859,7 +859,7 @@ class TestValidateConfigEndpoint:},content_type="application/json",)- assert response.status_code in [200, 302, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_validate_config_invalid_datasets(self):"""Test validation with invalid datasets config."""@@ -882,7 +882,7 @@ class TestValidateConfigEndpoint:},content_type="application/json",)- assert response.status_code in [200, 302, 401, 403, 500]+ assert response.status_code == 401, response.status_codeclass TestBenchmarkEdgeCases:@@ -908,7 +908,7 @@ class TestBenchmarkEdgeCases:},content_type="application/json",)- assert response.status_code in [200, 302, 400, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_special_characters_in_run_name(self):"""Test benchmark with special characters in run name."""@@ -930,7 +930,7 @@ class TestBenchmarkEdgeCases:},content_type="application/json",)- assert response.status_code in [200, 302, 400, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_sql_injection_in_run_id(self):"""Test SQL injection attempt in run_id."""@@ -947,7 +947,7 @@ class TestBenchmarkEdgeCases:response = client.get("/benchmark/api/results/'; DROP TABLE benchmark_runs; --")- assert response.status_code in [200, 302, 400, 401, 403, 404, 500]+ assert response.status_code == 404, response.status_codedef test_negative_count_in_datasets(self):"""Test negative count in datasets config."""@@ -968,7 +968,7 @@ class TestBenchmarkEdgeCases:},content_type="application/json",)- assert response.status_code in [200, 302, 400, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_invalid_dataset_name(self):"""Test invalid dataset name."""@@ -989,7 +989,7 @@ class TestBenchmarkEdgeCases:},content_type="application/json",)- assert response.status_code in [200, 302, 400, 401, 403, 500]+ assert response.status_code == 401, response.status_codeclass TestBenchmarkResultsEndpoint:@@ -1008,7 +1008,7 @@ class TestBenchmarkResultsEndpoint:with app.test_client() as client:response = client.get("/benchmark/api/results/run123?limit=10")- assert response.status_code in [200, 302, 401, 403, 404, 500]+ assert response.status_code == 404, response.status_codedef test_get_results_nonexistent_run(self):"""Test getting results for nonexistent run."""@@ -1025,7 +1025,7 @@ class TestBenchmarkResultsEndpoint:response = client.get("/benchmark/api/results/nonexistent-run-12345")- assert response.status_code in [302, 401, 403, 404, 500]+ assert response.status_code == 404, response.status_codeclass TestCancelBenchmarkEndpoint:@@ -1046,7 +1046,7 @@ class TestCancelBenchmarkEndpoint:response = client.post("/benchmark/api/cancel/nonexistent-run-12345")- assert response.status_code in [302, 401, 403, 404, 500]+ assert response.status_code == 404, response.status_codeclass TestDeleteBenchmarkEndpoint:@@ -1067,7 +1067,7 @@ class TestDeleteBenchmarkEndpoint:response = client.delete("/benchmark/api/delete/nonexistent-run-12345")- assert response.status_code in [302, 401, 403, 404, 405, 500]+ assert response.status_code == 404, response.status_codeclass TestSearchConfigSnapshotsLLMSettings:@@ -1207,7 +1207,7 @@ class TestExportBenchmarkResults:with app.test_client() as client:response = client.get("/benchmark/api/results/1/export")- assert response.status_code in [200, 302, 401, 403, 500]+ assert response.status_code == 401, response.status_codedef test_export_returns_lightweight_results(self):"""Test that export returns results without heavy columns."""@@ -1264,7 +1264,7 @@ class TestExportBenchmarkResults:response = client.get("/benchmark/api/results/1/export")# May redirect due to auth, but route works- assert response.status_code in [200, 302, 401, 500]+ assert response.status_code == 401, response.status_codeif response.status_code == 200:data = response.get_json()@@ -1326,7 +1326,7 @@ class TestExportBenchmarkResults:response = client.get("/benchmark/api/results/999/export")- assert response.status_code in [200, 302, 401, 500]+ assert response.status_code == 401, response.status_codeif response.status_code == 200:data = response.get_json()@@ -1374,7 +1374,7 @@ class TestExportBenchmarkResults:mock_query.all.return_value = []response = client.get("/benchmark/api/results/1/export")- assert response.status_code in [200, 302, 401, 500]+ assert response.status_code == 401, response.status_code# Verify order_by was called (confirming ASC ordering)if response.status_code == 200: