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.

test(auth): migrate test_inmemory_storage.test_expiration to freezegun (#4236)

LearningCircuit850c3a96568d
diff --git a/tests/auth_tests/test_inmemory_storage.py b/tests/auth_tests/test_inmemory_storage.py
index afa3f8cb96..708d1ef181 100644
--- a/tests/auth_tests/test_inmemory_storage.py
+++ b/tests/auth_tests/test_inmemory_storage.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Test in-memory storage after encryption removal (issue #593)."""
-import time
+from freezegun import freeze_time
from local_deep_research.database.session_passwords import (
session_password_store,
@@ -137,14 +137,16 @@ class TestTemporaryAuthStore:
# Set very short TTL
temp_auth_store.ttl = 1 # 1 second
- token = temp_auth_store.store_auth(username, password)
-
- # Wait for expiration
- time.sleep(2) # allow: unmarked-sleep
-
- # Should be expired
- expired = temp_auth_store.peek_auth(token)
- assert expired is None
+ # SUT (credential_store_base) uses time.time() for TTL
+ # comparison, so freezegun fully mocks the clock —
+ # no real sleep required.
+ with freeze_time("2026-01-01 00:00:00") as frozen:
+ token = temp_auth_store.store_auth(username, password)
+ # Advance past TTL
+ frozen.tick(2)
+ # Should be expired
+ expired = temp_auth_store.peek_auth(token)
+ assert expired is None
finally:
# Restore original TTL