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 3 misc test files (#4165)

LearningCircuit2d2e4ad65ee4
diff --git a/tests/followup_research/test_routes.py b/tests/followup_research/test_routes.py
index 46a7e70374..1de94ff669 100644
--- a/tests/followup_research/test_routes.py
+++ b/tests/followup_research/test_routes.py
@@ -87,7 +87,7 @@ class TestPrepareRouteValidation:
content_type="text/plain",
)
# Should fail somehow (either 400 or 415 or auth error)
- assert response.status_code in [400, 401, 415, 500]
+ assert response.status_code == 401, response.status_code
def test_prepare_empty_json(self, client):
"""Prepare with empty JSON body."""
@@ -96,7 +96,7 @@ class TestPrepareRouteValidation:
json={},
)
# Should fail with validation or auth error
- assert response.status_code in [400, 401, 500]
+ assert response.status_code == 401, response.status_code
class TestStartRouteValidation:
@@ -110,7 +110,7 @@ class TestStartRouteValidation:
content_type="text/plain",
)
# Should fail somehow
- assert response.status_code in [400, 401, 415, 500]
+ assert response.status_code == 401, response.status_code
def test_start_empty_json(self, client):
"""Start with empty JSON body."""
@@ -119,7 +119,7 @@ class TestStartRouteValidation:
json={},
)
# Should fail with validation or auth error
- assert response.status_code in [400, 401, 500]
+ assert response.status_code == 401, response.status_code
class TestRouteAuthentication:
@@ -135,7 +135,7 @@ class TestRouteAuthentication:
},
)
# Should redirect to login or return 401
- assert response.status_code in [302, 401, 403]
+ assert response.status_code == 401, response.status_code
def test_start_requires_login(self, client):
"""Start endpoint requires authentication."""
@@ -147,4 +147,4 @@ class TestRouteAuthentication:
},
)
# Should redirect to login or return 401
- assert response.status_code in [302, 401, 403]
+ assert response.status_code == 401, response.status_code
diff --git a/tests/pdf_tests/test_pdf_upload.py b/tests/pdf_tests/test_pdf_upload.py
index 0e5e1bf62c..88ece04258 100644
--- a/tests/pdf_tests/test_pdf_upload.py
+++ b/tests/pdf_tests/test_pdf_upload.py
@@ -27,7 +27,7 @@ class TestPDFUpload:
)
# Should redirect to login or return 401/302
- assert response.status_code in [302, 401]
+ assert response.status_code == 401, response.status_code
def test_upload_no_files_returns_error(self, authenticated_client):
"""Test that requests without files return appropriate error."""
@@ -112,7 +112,7 @@ class TestPDFUpload:
# If 200, should have errors
assert len(data.get("errors", [])) > 0
else:
- assert response.status_code in [400, 413]
+ assert response.status_code == 400, response.status_code
def test_upload_too_many_files_rejected(self, authenticated_client):
"""Test that more than MAX_FILES_PER_REQUEST files are rejected."""
@@ -153,7 +153,7 @@ class TestPDFUpload:
# Should not crash - either 200 with errors or 400
data = response.get_json()
- assert response.status_code in [200, 400]
+ assert response.status_code == 400, response.status_code
if response.status_code == 200:
# Should report errors for the malformed file
assert (
@@ -216,7 +216,7 @@ class TestPDFUploadSecurity:
)
# Should not crash and should sanitize filename
- assert response.status_code in [200, 400]
+ assert response.status_code == 400, response.status_code
if response.status_code == 200:
data = response.get_json()
# Check filename is sanitized in response
@@ -236,7 +236,7 @@ class TestPDFUploadSecurity:
)
# Should handle gracefully
- assert response.status_code in [200, 400]
+ assert response.status_code == 400, response.status_code
def test_very_long_filename_handled(self, authenticated_client):
"""Test that very long filenames are handled."""
@@ -251,4 +251,4 @@ class TestPDFUploadSecurity:
)
# Should handle gracefully
- assert response.status_code in [200, 400]
+ assert response.status_code == 400, response.status_code
diff --git a/tests/routes/test_settings_routes.py b/tests/routes/test_settings_routes.py
index f9436156aa..dad0e9e881 100644
--- a/tests/routes/test_settings_routes.py
+++ b/tests/routes/test_settings_routes.py
@@ -583,7 +583,7 @@ class TestSettingsPageRoute:
try:
response = client.get("/settings/")
# Route exists if we get any response
- assert response.status_code in [200, 302, 401, 403, 404, 500]
+ assert response.status_code == 302, response.status_code
except Exception:
# If dependencies fail to load, that's okay - route structure exists
pass
@@ -601,7 +601,7 @@ class TestSaveAllSettingsRoute:
content_type="application/json",
)
# Route exists if we get any response
- assert response.status_code in [200, 302, 400, 401, 403, 404, 500]
+ assert response.status_code == 401, response.status_code
except Exception:
# If dependencies fail to load, that's okay - route structure exists
pass
@@ -630,7 +630,7 @@ class TestAPIRoutes:
try:
response = client.get("/settings/api/types")
# Will likely fail due to auth, but we test the route exists
- assert response.status_code in [200, 302, 401, 403]
+ assert response.status_code == 401, response.status_code
finally:
settings_routes.login_required = original_login_required
@@ -639,7 +639,7 @@ class TestAPIRoutes:
# Route should exist and be accessible
response = client.get("/settings/api/ui_elements")
# May redirect or require auth
- assert response.status_code in [200, 302, 401, 403]
+ assert response.status_code == 401, response.status_code
class TestLegacyRedirects:
@@ -838,13 +838,13 @@ class TestRateLimitingEndpoints:
"""Test that cleanup route exists."""
response = client.post("/settings/api/rate-limiting/cleanup")
# Should exist, may require auth
- assert response.status_code in [200, 302, 400, 401, 403, 415]
+ assert response.status_code == 401, response.status_code
def test_rate_limiting_status_route_exists(self, client):
"""Test that status route exists."""
response = client.get("/settings/api/rate-limiting/status")
# Should exist, may require auth
- assert response.status_code in [200, 302, 401, 403]
+ assert response.status_code == 401, response.status_code
class TestBulkSettingsEndpoint:
@@ -854,7 +854,7 @@ class TestBulkSettingsEndpoint:
"""Test that bulk settings route exists."""
response = client.get("/settings/api/bulk")
# Should exist, may require auth
- assert response.status_code in [200, 302, 401, 403]
+ assert response.status_code == 401, response.status_code
class TestDataLocationEndpoint:
@@ -864,7 +864,7 @@ class TestDataLocationEndpoint:
"""Test that data location route exists."""
response = client.get("/settings/api/data-location")
# Should exist, may require auth
- assert response.status_code in [200, 302, 401, 403]
+ assert response.status_code == 401, response.status_code
class TestNotificationTestEndpoint:
@@ -877,4 +877,4 @@ class TestNotificationTestEndpoint:
json={"service_url": "mailto://[email protected]"},
)
# Should exist, may require auth
- assert response.status_code in [200, 302, 400, 401, 403]
+ assert response.status_code == 401, response.status_code