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): align tests with tuple keys and POST-only logout (#3278)

LearningCircuit3704ea2e76b7
diff --git a/tests/database/test_session_passwords.py b/tests/database/test_session_passwords.py
index 2bfbe07348..51431d15d1 100644
--- a/tests/database/test_session_passwords.py
+++ b/tests/database/test_session_passwords.py
@@ -89,7 +89,7 @@ class TestSessionPasswordStore:
store.clear_session("nonexistent", "nosession")
def test_session_key_format_is_username_session_id(self):
- """Session key format is 'username:session_id'."""
+ """Session key format is (username, session_id) tuple."""
from local_deep_research.database.session_passwords import (
SessionPasswordStore,
)
@@ -98,7 +98,7 @@ class TestSessionPasswordStore:
store.store_session_password("myuser", "mysession", "pass")
# Check the internal key format
- expected_key = "myuser:mysession"
+ expected_key = ("myuser", "mysession")
assert expected_key in store._store
def test_password_expires_after_ttl(self):
@@ -113,7 +113,7 @@ class TestSessionPasswordStore:
store.store_session_password("user1", "sess1", "pass123")
# Manually set expiration to past
- key = "user1:sess1"
+ key = ("user1", "sess1")
store._store[key]["expires_at"] = time.time() - 1
# Should return None
diff --git a/tests/security/test_auth_security.py b/tests/security/test_auth_security.py
index cf8a4bb605..b49ecd2d70 100644
--- a/tests/security/test_auth_security.py
+++ b/tests/security/test_auth_security.py
@@ -142,7 +142,7 @@ class TestSessionSecurity:
# 4. Redirect to login page
# Test logout endpoint
- response = client.get("/auth/logout")
+ response = client.post("/auth/logout")
assert response.status_code in [200, 302] # OK or redirect
# After logout, protected pages should require re-authentication
diff --git a/tests/web/auth/test_auth_routes.py b/tests/web/auth/test_auth_routes.py
index 25c185ff0b..8fc2f59a81 100644
--- a/tests/web/auth/test_auth_routes.py
+++ b/tests/web/auth/test_auth_routes.py
@@ -407,7 +407,7 @@ class TestLogout:
sess["username"] = "testuser"
sess["session_id"] = "session_123"
- response = client.get("/auth/logout")
+ response = client.post("/auth/logout")
assert response.status_code == 302
with client.session_transaction() as sess:
@@ -431,7 +431,7 @@ class TestLogout:
app.register_blueprint(auth_bp)
with app.test_client() as client:
- response = client.get("/auth/logout")
+ response = client.post("/auth/logout")
assert response.status_code == 302
assert "login" in response.location
@@ -464,7 +464,7 @@ class TestLogout:
sess["username"] = "testuser"
sess["session_id"] = "session_123"
- client.get("/auth/logout")
+ client.post("/auth/logout")
mock_scheduler.unregister_user.assert_called_once_with(
"testuser"
)
diff --git a/tests/web/queue/test_processor_v2.py b/tests/web/queue/test_processor_v2.py
index 0de0606346..7a9da60051 100644
--- a/tests/web/queue/test_processor_v2.py
+++ b/tests/web/queue/test_processor_v2.py
@@ -143,7 +143,7 @@ class TestQueueProcessorV2NotifyUserActivity:
processor.notify_user_activity("testuser", "session123")
- assert "testuser:session123" in processor._users_to_check
+ assert ("testuser", "session123") in processor._users_to_check
def test_notify_user_activity_thread_safe(self):
"""notify_user_activity is thread safe."""
diff --git a/tests/web/queue/test_processor_v2_concurrency.py b/tests/web/queue/test_processor_v2_concurrency.py
index 9ff21e04e2..f2130a1fba 100644
--- a/tests/web/queue/test_processor_v2_concurrency.py
+++ b/tests/web/queue/test_processor_v2_concurrency.py
@@ -350,7 +350,7 @@ class TestNotifyUserActivityConcurrency:
assert not errors
assert len(processor._users_to_check) == 20
for i in range(20):
- assert f"user-{i}:sess-{i}" in processor._users_to_check
+ assert (f"user-{i}", f"sess-{i}") in processor._users_to_check
def test_duplicate_user_session_deduplicated(self, processor):
"""Same user:session added multiple times is stored once (set behavior)."""
@@ -358,7 +358,7 @@ class TestNotifyUserActivityConcurrency:
processor.notify_user_activity("alice", "sess-1")
assert len(processor._users_to_check) == 1
- assert "alice:sess-1" in processor._users_to_check
+ assert ("alice", "sess-1") in processor._users_to_check
# ---------------------------------------------------------------------------
diff --git a/tests/web/queue/test_processor_v2_real.py b/tests/web/queue/test_processor_v2_real.py
index 6e4552246e..6b22ea3340 100644
--- a/tests/web/queue/test_processor_v2_real.py
+++ b/tests/web/queue/test_processor_v2_real.py
@@ -394,9 +394,9 @@ class TestProcessQueueLoop:
"""Tests for _process_queue_loop."""
def test_parses_user_session_format(self):
- """Correctly parses 'username:session_id' entries."""
+ """Correctly parses (username, session_id) tuple entries."""
processor = _make_processor()
- processor._users_to_check.add("alice:sess-abc")
+ processor._users_to_check.add(("alice", "sess-abc"))
with patch.object(
processor, "_process_user_queue", return_value=True
@@ -416,8 +416,8 @@ class TestProcessQueueLoop:
def test_removes_users_with_empty_queues(self):
"""Users whose queues are empty get removed from check set."""
processor = _make_processor()
- processor._users_to_check.add("alice:sess1")
- processor._users_to_check.add("bob:sess2")
+ processor._users_to_check.add(("alice", "sess1"))
+ processor._users_to_check.add(("bob", "sess2"))
def side_effect(username, session_id):
return username == "alice" # alice's queue is empty
@@ -434,13 +434,13 @@ class TestProcessQueueLoop:
threading.Thread(target=stop_after_one).start()
processor._process_queue_loop()
- assert "alice:sess1" not in processor._users_to_check
- assert "bob:sess2" in processor._users_to_check
+ assert ("alice", "sess1") not in processor._users_to_check
+ assert ("bob", "sess2") in processor._users_to_check
def test_keeps_users_on_error(self):
"""Users are kept if _process_user_queue raises."""
processor = _make_processor()
- processor._users_to_check.add("alice:sess1")
+ processor._users_to_check.add(("alice", "sess1"))
with patch.object(
processor,
@@ -456,7 +456,7 @@ class TestProcessQueueLoop:
threading.Thread(target=stop_after_one).start()
processor._process_queue_loop()
- assert "alice:sess1" in processor._users_to_check
+ assert ("alice", "sess1") in processor._users_to_check
# ---------------------------------------------------------------------------