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(tests): narrow broad status-code tautologies in 2 small web/routes files (#4177)

LearningCircuitb263b43c2b8f
diff --git a/tests/web/routes/test_search_favorites.py b/tests/web/routes/test_search_favorites.py
index 50d7b891e6..0aa890b3df 100644
--- a/tests/web/routes/test_search_favorites.py
+++ b/tests/web/routes/test_search_favorites.py
@@ -13,7 +13,7 @@ class TestGetSearchFavorites:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{SETTINGS_PREFIX}/api/search-favorites")
- assert response.status_code in [401, 302]
+ assert response.status_code == 401, response.status_code
def test_returns_empty_list_when_no_favorites(self, authenticated_client):
"""Should return empty list when no favorites are set."""
@@ -86,7 +86,7 @@ class TestUpdateSearchFavorites:
f"{SETTINGS_PREFIX}/api/search-favorites",
json={"favorites": ["searxng"]},
)
- assert response.status_code in [401, 302]
+ assert response.status_code == 401, response.status_code
def test_requires_json_body(self, authenticated_client):
"""Should require JSON body."""
@@ -96,7 +96,7 @@ class TestUpdateSearchFavorites:
content_type="text/plain",
)
# Flask may return 400 or 500 for invalid content type
- assert response.status_code in [400, 500]
+ assert response.status_code == 400, response.status_code
def test_requires_favorites_field(self, authenticated_client):
"""Should require favorites field in request."""
@@ -193,7 +193,7 @@ class TestToggleSearchFavorite:
f"{SETTINGS_PREFIX}/api/search-favorites/toggle",
json={"engine_id": "searxng"},
)
- assert response.status_code in [401, 302]
+ assert response.status_code == 401, response.status_code
def test_requires_json_body(self, authenticated_client):
"""Should require JSON body."""
@@ -203,7 +203,7 @@ class TestToggleSearchFavorite:
content_type="text/plain",
)
# Flask may return 400 or 500 for invalid content type
- assert response.status_code in [400, 500]
+ assert response.status_code == 400, response.status_code
def test_requires_engine_id(self, authenticated_client):
"""Should require engine_id field."""
@@ -298,7 +298,7 @@ class TestAvailableSearchEnginesWithFavorites:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{SETTINGS_PREFIX}/api/available-search-engines")
- assert response.status_code in [401, 302]
+ assert response.status_code == 401, response.status_code
def test_response_includes_favorites_field(self, authenticated_client):
"""Should include favorites field in response."""
diff --git a/tests/web/routes/test_settings_routes_rate_limiting.py b/tests/web/routes/test_settings_routes_rate_limiting.py
index 71b034b13e..665d7c91cd 100644
--- a/tests/web/routes/test_settings_routes_rate_limiting.py
+++ b/tests/web/routes/test_settings_routes_rate_limiting.py
@@ -11,7 +11,7 @@ class TestApiGetRateLimitingStatus:
def test_requires_authentication(self, client):
response = client.get(f"{SETTINGS_PREFIX}/api/rate-limiting/status")
- assert response.status_code in [401, 302]
+ assert response.status_code == 401, response.status_code
@patch("local_deep_research.web_search_engines.rate_limiting.get_tracker")
def test_returns_status_and_engines(
@@ -77,7 +77,7 @@ class TestApiResetEngineRateLimiting:
response = client.post(
f"{SETTINGS_PREFIX}/api/rate-limiting/engines/google/reset"
)
- assert response.status_code in [401, 302]
+ assert response.status_code == 401, response.status_code
@patch("local_deep_research.web_search_engines.rate_limiting.get_tracker")
def test_resets_engine(self, mock_get_tracker, authenticated_client):
@@ -109,7 +109,7 @@ class TestApiCleanupRateLimiting:
def test_requires_authentication(self, client):
response = client.post(f"{SETTINGS_PREFIX}/api/rate-limiting/cleanup")
- assert response.status_code in [401, 302]
+ assert response.status_code == 401, response.status_code
@patch("local_deep_research.web_search_engines.rate_limiting.get_tracker")
def test_cleanup_default_days(self, mock_get_tracker, authenticated_client):
@@ -153,7 +153,7 @@ class TestCheckOllamaStatusSettings:
def test_requires_authentication(self, client):
response = client.get(f"{SETTINGS_PREFIX}/api/ollama-status")
- assert response.status_code in [401, 302]
+ assert response.status_code == 401, response.status_code
@patch("local_deep_research.web.routes.settings_routes.safe_get")
@patch(
@@ -223,7 +223,7 @@ class TestApiTestNotificationUrl:
f"{SETTINGS_PREFIX}/api/notifications/test-url",
json={"service_url": "http://example.com"},
)
- assert response.status_code in [401, 302]
+ assert response.status_code == 401, response.status_code
@patch("local_deep_research.notifications.service.NotificationService")
def test_successful_test(self, mock_ns_cls, authenticated_client):
@@ -274,7 +274,7 @@ class TestApiTestNotificationUrl:
f"{SETTINGS_PREFIX}/api/notifications/test-url",
)
# No JSON body causes get_json() to return None, hitting the error handler
- assert response.status_code in [400, 500]
+ assert response.status_code == 500, response.status_code
@patch("local_deep_research.notifications.service.NotificationService")
def test_does_not_leak_internal_details(