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 test_research_routes.py (#4138)

LearningCircuitad2d15578b66
diff --git a/tests/web/routes/test_research_routes.py b/tests/web/routes/test_research_routes.py
index 1d3ba1684f..863625589a 100644
--- a/tests/web/routes/test_research_routes.py
+++ b/tests/web/routes/test_research_routes.py
@@ -16,7 +16,7 @@ class TestProgressPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/progress/test-id")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_returns_page_when_authenticated(self, authenticated_client):
"""Should return progress page when authenticated."""
@@ -37,7 +37,7 @@ class TestResearchDetailsPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/details/test-id")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_returns_page_when_authenticated(self, authenticated_client):
"""Should return details page when authenticated."""
@@ -58,7 +58,7 @@ class TestResultsPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/results/test-id")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_returns_page_when_authenticated(self, authenticated_client):
"""Should return results page when authenticated."""
@@ -79,7 +79,7 @@ class TestHistoryPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/history")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_returns_page_when_authenticated(self, authenticated_client):
"""Should return history page when authenticated."""
@@ -98,7 +98,7 @@ class TestSettingsPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/settings")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_returns_page_when_authenticated(self, authenticated_client):
"""Should return settings page when authenticated."""
@@ -117,7 +117,7 @@ class TestMainConfigPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/settings/main")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_redirects_when_authenticated(self, authenticated_client):
"""Should redirect to settings dashboard."""
@@ -131,7 +131,7 @@ class TestCollectionsConfigPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/settings/collections")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_redirects_when_authenticated(self, authenticated_client):
"""Should redirect to settings dashboard."""
@@ -147,7 +147,7 @@ class TestApiKeysConfigPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/settings/api_keys")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_redirects_when_authenticated(self, authenticated_client):
"""Should redirect to settings dashboard."""
@@ -163,7 +163,7 @@ class TestSearchEnginesConfigPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/settings/search_engines")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_redirects_when_authenticated(self, authenticated_client):
"""Should redirect to settings dashboard."""
@@ -179,7 +179,7 @@ class TestLlmConfigPage:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/settings/llm")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 302, response.status_code
def test_redirects_when_authenticated(self, authenticated_client):
"""Should redirect to settings dashboard."""
@@ -209,7 +209,7 @@ class TestStartResearchApi:
f"{RESEARCH_PREFIX}/api/start_research",
json={"query": "test query"},
)
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 401, response.status_code
def test_returns_401_without_session(self, authenticated_client):
"""Should return 401 when session has no username."""
@@ -232,7 +232,7 @@ class TestStartResearchApi:
content_type="text/plain",
)
# Should return error for non-JSON body
- assert response.status_code in [400, 415, 500]
+ assert response.status_code == 400, response.status_code
class TestTerminateResearchApi:
@@ -241,7 +241,7 @@ class TestTerminateResearchApi:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.post(f"{RESEARCH_PREFIX}/api/terminate/test-id")
- assert response.status_code in [401, 302, 404, 405]
+ assert response.status_code == 401, response.status_code
def test_returns_success_when_authenticated(self, authenticated_client):
"""Should handle terminate request when authenticated."""
@@ -255,7 +255,7 @@ class TestTerminateResearchApi:
response = authenticated_client.post(
f"{RESEARCH_PREFIX}/api/terminate/test-id"
)
- assert response.status_code in [200, 404, 500]
+ assert response.status_code == 200, response.status_code
class TestDeleteResearchApi:
@@ -264,7 +264,7 @@ class TestDeleteResearchApi:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.delete(f"{RESEARCH_PREFIX}/api/delete/test-id")
- assert response.status_code in [401, 302, 404, 405]
+ assert response.status_code == 401, response.status_code
def test_returns_success_when_authenticated(self, authenticated_client):
"""Should handle delete request when authenticated."""
@@ -279,7 +279,7 @@ class TestDeleteResearchApi:
response = authenticated_client.delete(
f"{RESEARCH_PREFIX}/api/delete/test-id"
)
- assert response.status_code in [200, 404, 500]
+ assert response.status_code == 200, response.status_code
class TestClearHistoryApi:
@@ -288,7 +288,7 @@ class TestClearHistoryApi:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.post(f"{RESEARCH_PREFIX}/api/clear_history")
- assert response.status_code in [401, 302, 404, 405]
+ assert response.status_code == 401, response.status_code
def test_returns_success_when_authenticated(self, authenticated_client):
"""Should handle clear history request when authenticated."""
@@ -300,7 +300,7 @@ class TestClearHistoryApi:
response = authenticated_client.post(
f"{RESEARCH_PREFIX}/api/clear_history"
)
- assert response.status_code in [200, 500]
+ assert response.status_code == 200, response.status_code
class TestGetHistoryApi:
@@ -309,7 +309,7 @@ class TestGetHistoryApi:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/api/history")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 401, response.status_code
def test_returns_history_when_authenticated(self, authenticated_client):
"""Should return history when authenticated."""
@@ -321,7 +321,7 @@ class TestGetHistoryApi:
response = authenticated_client.get(
f"{RESEARCH_PREFIX}/api/history"
)
- assert response.status_code in [200, 500]
+ assert response.status_code == 200, response.status_code
class TestGetResearchDetailsApi:
@@ -330,7 +330,7 @@ class TestGetResearchDetailsApi:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/api/research/test-id")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 401, response.status_code
def test_returns_details_when_authenticated(self, authenticated_client):
"""Should return research details when authenticated."""
@@ -342,7 +342,7 @@ class TestGetResearchDetailsApi:
response = authenticated_client.get(
f"{RESEARCH_PREFIX}/api/research/test-id"
)
- assert response.status_code in [200, 404, 500]
+ assert response.status_code == 404, response.status_code
class TestGetResearchLogsApi:
@@ -351,7 +351,7 @@ class TestGetResearchLogsApi:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/api/research/test-id/logs")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 401, response.status_code
def test_returns_logs_when_authenticated(self, authenticated_client):
"""Should return research logs when authenticated."""
@@ -363,7 +363,7 @@ class TestGetResearchLogsApi:
response = authenticated_client.get(
f"{RESEARCH_PREFIX}/api/research/test-id/logs"
)
- assert response.status_code in [200, 404, 500]
+ assert response.status_code == 404, response.status_code
class TestGetResearchStatusApi:
@@ -372,7 +372,7 @@ class TestGetResearchStatusApi:
def test_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/api/research/test-id/status")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 401, response.status_code
def test_returns_status_when_authenticated(self, authenticated_client):
"""Should return research status when authenticated."""
@@ -384,7 +384,7 @@ class TestGetResearchStatusApi:
response = authenticated_client.get(
f"{RESEARCH_PREFIX}/api/research/test-id/status"
)
- assert response.status_code in [200, 404, 500]
+ assert response.status_code == 404, response.status_code
class TestQueueStatusApi:
@@ -393,7 +393,7 @@ class TestQueueStatusApi:
def test_get_queue_status_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/api/queue/status")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 401, response.status_code
def test_get_queue_status_when_authenticated(self, authenticated_client):
"""Should return queue status when authenticated."""
@@ -402,9 +402,9 @@ class TestQueueStatusApi:
response = authenticated_client.get(
f"{RESEARCH_PREFIX}/api/queue/status"
)
- assert response.status_code in [200, 500]
+ assert response.status_code == 200, response.status_code
def test_get_queue_position_requires_authentication(self, client):
"""Should require authentication."""
response = client.get(f"{RESEARCH_PREFIX}/api/queue/test-id/position")
- assert response.status_code in [401, 302, 404]
+ assert response.status_code == 401, response.status_code