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: wrap UI test utility scripts and fix remaining test signature

LearningCircuite98286c5a26d
diff --git a/tests/auth_tests/test_sqlcipher_rekey.py b/tests/auth_tests/test_sqlcipher_rekey.py
index 9a955a3998..15a6e5ac9a 100644
--- a/tests/auth_tests/test_sqlcipher_rekey.py
+++ b/tests/auth_tests/test_sqlcipher_rekey.py
@@ -13,6 +13,7 @@ import pytest
from src.local_deep_research.database.sqlcipher_utils import (
apply_cipher_settings_before_key,
+ get_sqlcipher_settings,
set_sqlcipher_key,
set_sqlcipher_rekey,
_get_key_from_password,
@@ -125,7 +126,8 @@ class TestRekeyFunctionality:
# Get derived key for a password
password = "test_password_for_derivation"
- derived_key = _get_key_from_password(password)
+ kdf_iterations = get_sqlcipher_settings()["kdf_iterations"]
+ derived_key = _get_key_from_password(password, kdf_iterations)
# The rekey function should use the same derivation
# We verify by checking that both set_sqlcipher_key and set_sqlcipher_rekey
@@ -134,7 +136,7 @@ class TestRekeyFunctionality:
assert cache_info.hits >= 0, "Function should use caching"
# Derive again to verify same result
- derived_key_2 = _get_key_from_password(password)
+ derived_key_2 = _get_key_from_password(password, kdf_iterations)
assert derived_key == derived_key_2, (
"Key derivation must be deterministic"
)
diff --git a/tests/ui_tests/test_check_research_thread.py b/tests/ui_tests/test_check_research_thread.py
index e7cafaa636..78742ed742 100644
--- a/tests/ui_tests/test_check_research_thread.py
+++ b/tests/ui_tests/test_check_research_thread.py
@@ -1,44 +1,59 @@
#!/usr/bin/env python3
-"""Check if research thread is running"""
+"""Check if research thread is running.
+
+This is a manual utility script, not a pytest test.
+Run directly with: python test_check_research_thread.py
+"""
import json
import requests
-# Login first
-session = requests.Session()
-login_data = {"username": "testuser", "password": "T3st!Secure#2024$LDR"}
-
-# Get CSRF token
-login_page = session.get("http://127.0.0.1:5000/auth/login")
-# Simple CSRF extraction (this is hacky but works for testing)
-csrf_token = login_page.text.split('name="csrf_token" value="')[1].split('"')[0]
-
-# Login
-login_data["csrf_token"] = csrf_token
-login_resp = session.post("http://127.0.0.1:5000/auth/login", data=login_data)
-print(f"Login status: {login_resp.status_code}")
-
-# Check research status
-research_id = 24
-status_resp = session.get(
- f"http://127.0.0.1:5000/api/research/{research_id}/status"
-)
-print(f"\nStatus response: {status_resp.status_code}")
-if status_resp.ok:
- data = status_resp.json()
- print(json.dumps(data, indent=2))
-
-# Check logs
-logs_resp = session.get(
- f"http://127.0.0.1:5000/api/research/{research_id}/logs"
-)
-print(f"\nLogs response: {logs_resp.status_code}")
-if logs_resp.ok:
- logs = logs_resp.json()
- if isinstance(logs, list):
- print(f"Number of log entries: {len(logs)}")
- for log in logs[-5:]: # Last 5 logs
- print(f" - {log.get('message', 'No message')}")
- else:
- print(f"Logs data: {logs}")
+
+def main():
+ """Check research thread status."""
+ # Login first
+ session = requests.Session()
+ login_data = {"username": "testuser", "password": "T3st!Secure#2024$LDR"}
+
+ # Get CSRF token
+ login_page = session.get("http://127.0.0.1:5000/auth/login")
+ # Simple CSRF extraction (this is hacky but works for testing)
+ csrf_token = login_page.text.split('name="csrf_token" value="')[1].split(
+ '"'
+ )[0]
+
+ # Login
+ login_data["csrf_token"] = csrf_token
+ login_resp = session.post(
+ "http://127.0.0.1:5000/auth/login", data=login_data
+ )
+ print(f"Login status: {login_resp.status_code}")
+
+ # Check research status
+ research_id = 24
+ status_resp = session.get(
+ f"http://127.0.0.1:5000/api/research/{research_id}/status"
+ )
+ print(f"\nStatus response: {status_resp.status_code}")
+ if status_resp.ok:
+ data = status_resp.json()
+ print(json.dumps(data, indent=2))
+
+ # Check logs
+ logs_resp = session.get(
+ f"http://127.0.0.1:5000/api/research/{research_id}/logs"
+ )
+ print(f"\nLogs response: {logs_resp.status_code}")
+ if logs_resp.ok:
+ logs = logs_resp.json()
+ if isinstance(logs, list):
+ print(f"Number of log entries: {len(logs)}")
+ for log in logs[-5:]: # Last 5 logs
+ print(f" - {log.get('message', 'No message')}")
+ else:
+ print(f"Logs data: {logs}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tests/ui_tests/test_simple_research_api.py b/tests/ui_tests/test_simple_research_api.py
index 04c429e298..5cc1ac3560 100644
--- a/tests/ui_tests/test_simple_research_api.py
+++ b/tests/ui_tests/test_simple_research_api.py
@@ -1,44 +1,43 @@
#!/usr/bin/env python3
-"""Test research submission directly via API"""
+"""Test research submission directly via API.
+
+This is a manual utility script, not a pytest test.
+Run directly with: python test_simple_research_api.py
+"""
import json
+import sys
import time
import requests
-# Login first
-session = requests.Session()
-login_data = {"username": "testuser_api", "password": "T3st!Secure#2024$LDR"}
-
-# Register if needed
-reg_page = session.get("http://127.0.0.1:5000/auth/register")
-csrf_token = reg_page.text.split('name="csrf_token" value="')[1].split('"')[0]
-
-reg_data = login_data.copy()
-reg_data["confirm_password"] = login_data["password"]
-reg_data["csrf_token"] = csrf_token
-reg_data["acknowledge"] = "on"
-
-reg_resp = session.post("http://127.0.0.1:5000/auth/register", data=reg_data)
-print(f"Registration status: {reg_resp.status_code}")
-
-# Login
-login_page = session.get("http://127.0.0.1:5000/auth/login")
-csrf_token = login_page.text.split('name="csrf_token" value="')[1].split('"')[0]
-login_data["csrf_token"] = csrf_token
-login_resp = session.post("http://127.0.0.1:5000/auth/login", data=login_data)
-print(f"Login status: {login_resp.status_code}")
-
-# Get CSRF token for API
-home_page = session.get("http://127.0.0.1:5000/")
-if 'name="csrf-token"' in home_page.text:
- csrf_token = home_page.text.split('name="csrf-token" content="')[1].split(
- '"'
- )[0]
-else:
- print("Not logged in properly, trying again...")
- # Try login with existing user
- login_data["username"] = "testuser"
+
+def main():
+ """Test research submission via API."""
+ # Login first
+ session = requests.Session()
+ login_data = {
+ "username": "testuser_api",
+ "password": "T3st!Secure#2024$LDR",
+ }
+
+ # Register if needed
+ reg_page = session.get("http://127.0.0.1:5000/auth/register")
+ csrf_token = reg_page.text.split('name="csrf_token" value="')[1].split('"')[
+ 0
+ ]
+
+ reg_data = login_data.copy()
+ reg_data["confirm_password"] = login_data["password"]
+ reg_data["csrf_token"] = csrf_token
+ reg_data["acknowledge"] = "on"
+
+ reg_resp = session.post(
+ "http://127.0.0.1:5000/auth/register", data=reg_data
+ )
+ print(f"Registration status: {reg_resp.status_code}")
+
+ # Login
login_page = session.get("http://127.0.0.1:5000/auth/login")
csrf_token = login_page.text.split('name="csrf_token" value="')[1].split(
'"'
@@ -47,68 +46,93 @@ else:
login_resp = session.post(
"http://127.0.0.1:5000/auth/login", data=login_data
)
- print(f"Re-login status: {login_resp.status_code}")
+ print(f"Login status: {login_resp.status_code}")
+ # Get CSRF token for API
home_page = session.get("http://127.0.0.1:5000/")
- if 'name="csrf_token"' in home_page.text:
- csrf_token = home_page.text.split('name="csrf_token" value="')[1].split(
- '"'
- )[0]
+ if 'name="csrf-token"' in home_page.text:
+ csrf_token = home_page.text.split('name="csrf-token" content="')[
+ 1
+ ].split('"')[0]
else:
- print("Failed to get CSRF token")
- exit(1)
-
-# Submit research
-research_data = {
- "query": "What is Python programming?",
- "mode": "quick",
- "model_provider": "OLLAMA",
- "model": "llama2",
- "search_engine": "searxng",
- "iterations": 1,
- "questions_per_iteration": 2,
- "strategy": "source-based",
-}
-
-headers = {"Content-Type": "application/json", "X-CSRFToken": csrf_token}
-
-print("\nSubmitting research...")
-submit_resp = session.post(
- "http://127.0.0.1:5000/api/start_research",
- json=research_data,
- headers=headers,
-)
-print(f"Submit status: {submit_resp.status_code}")
-
-if submit_resp.ok:
- result = submit_resp.json()
- print(f"Result: {json.dumps(result, indent=2)}")
-
- if result.get("status") == "success":
- research_id = result.get("research_id")
- print(f"\nResearch ID: {research_id}")
-
- # Check status after a few seconds
- for i in range(5):
- time.sleep(2)
- status_resp = session.get(
- f"http://127.0.0.1:5000/api/research/{research_id}/status"
- )
- if status_resp.ok:
- status = status_resp.json()
- print(
- f"\nCheck {i + 1}: Status={status.get('status')}, Progress={status.get('progress')}"
- )
+ print("Not logged in properly, trying again...")
+ # Try login with existing user
+ login_data["username"] = "testuser"
+ login_page = session.get("http://127.0.0.1:5000/auth/login")
+ csrf_token = login_page.text.split('name="csrf_token" value="')[
+ 1
+ ].split('"')[0]
+ login_data["csrf_token"] = csrf_token
+ login_resp = session.post(
+ "http://127.0.0.1:5000/auth/login", data=login_data
+ )
+ print(f"Re-login status: {login_resp.status_code}")
+
+ home_page = session.get("http://127.0.0.1:5000/")
+ if 'name="csrf_token"' in home_page.text:
+ csrf_token = home_page.text.split('name="csrf_token" value="')[
+ 1
+ ].split('"')[0]
+ else:
+ print("Failed to get CSRF token")
+ sys.exit(1)
+
+ # Submit research
+ research_data = {
+ "query": "What is Python programming?",
+ "mode": "quick",
+ "model_provider": "OLLAMA",
+ "model": "llama2",
+ "search_engine": "searxng",
+ "iterations": 1,
+ "questions_per_iteration": 2,
+ "strategy": "source-based",
+ }
+
+ headers = {"Content-Type": "application/json", "X-CSRFToken": csrf_token}
+
+ print("\nSubmitting research...")
+ submit_resp = session.post(
+ "http://127.0.0.1:5000/api/start_research",
+ json=research_data,
+ headers=headers,
+ )
+ print(f"Submit status: {submit_resp.status_code}")
+
+ if submit_resp.ok:
+ result = submit_resp.json()
+ print(f"Result: {json.dumps(result, indent=2)}")
+
+ if result.get("status") == "success":
+ research_id = result.get("research_id")
+ print(f"\nResearch ID: {research_id}")
- # Get logs
- logs_resp = session.get(
- f"http://127.0.0.1:5000/api/research/{research_id}/logs"
+ # Check status after a few seconds
+ for i in range(5):
+ time.sleep(2)
+ status_resp = session.get(
+ f"http://127.0.0.1:5000/api/research/{research_id}/status"
)
- if logs_resp.ok:
- logs = logs_resp.json()
- if isinstance(logs, list) and logs:
- print(
- f"Latest log: {logs[-1].get('message', 'No message')}"
- )
-else:
- print(f"Error: {submit_resp.text[:500]}")
+ if status_resp.ok:
+ status = status_resp.json()
+ print(
+ f"\nCheck {i + 1}: Status={status.get('status')}, "
+ f"Progress={status.get('progress')}"
+ )
+
+ # Get logs
+ logs_resp = session.get(
+ f"http://127.0.0.1:5000/api/research/{research_id}/logs"
+ )
+ if logs_resp.ok:
+ logs = logs_resp.json()
+ if isinstance(logs, list) and logs:
+ print(
+ f"Latest log: {logs[-1].get('message', 'No message')}"
+ )
+ else:
+ print(f"Error: {submit_resp.text[:500]}")
+
+
+if __name__ == "__main__":
+ main()