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: make settings type-conversion tests find keys dynamically (#3116)

LearningCircuitdb56f58ccbaf
diff --git a/src/local_deep_research/web/static/css/mobile-responsive.css b/src/local_deep_research/web/static/css/mobile-responsive.css
index b833379d1a..770b8889ab 100644
--- a/src/local_deep_research/web/static/css/mobile-responsive.css
+++ b/src/local_deep_research/web/static/css/mobile-responsive.css
@@ -480,12 +480,13 @@
font-size: 1rem !important;
}
- /* Form inputs */
+ /* Form inputs — 44px min for mobile touch targets */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
+ .form-control,
textarea,
select {
min-height: 44px !important;
@@ -505,7 +506,7 @@
.dropdown-item,
.ldr-dropdown-item {
padding: 0.75rem 1rem !important;
- min-height: 44px;
+ min-height: 44px !important;
}
/* Icon buttons need proper sizing */
diff --git a/tests/web/routes/test_settings_routes.py b/tests/web/routes/test_settings_routes.py
index 4c55e37924..9b17585a82 100644
--- a/tests/web/routes/test_settings_routes.py
+++ b/tests/web/routes/test_settings_routes.py
@@ -1,5 +1,6 @@
"""Tests for settings_routes module - Settings API endpoints."""
+import pytest
from unittest.mock import patch, MagicMock, Mock
SETTINGS_PREFIX = "/settings"
@@ -975,26 +976,34 @@ class TestApiUpdateSettingTypeConversion:
def test_put_string_number_stored_as_int(self, authenticated_client):
"""PUT string "999" for number setting -> GET returns int 999."""
- # Find a number setting to test with
- get_resp = authenticated_client.get(
- f"{SETTINGS_PREFIX}/api/search.iterations"
- )
- assert get_resp.status_code == 200
- original = get_resp.get_json()
- assert original["ui_element"] == "number"
+ # Find a number setting to test with — scan all settings for one
+ # with ui_element == "number" since specific keys may not be seeded
+ all_resp = authenticated_client.get(f"{SETTINGS_PREFIX}/api/all")
+ assert all_resp.status_code == 200
+ all_settings = all_resp.get_json()
+
+ number_setting = None
+ for s in all_settings:
+ if s.get("ui_element") == "number" and s.get("editable", True):
+ number_setting = s
+ break
+
+ if number_setting is None:
+ pytest.skip("No editable number setting found in test database")
+
+ key = number_setting["key"]
+ original_value = number_setting["value"]
# PUT a string number
put_resp = authenticated_client.put(
- f"{SETTINGS_PREFIX}/api/search.iterations",
+ f"{SETTINGS_PREFIX}/api/{key}",
json={"value": "999"},
content_type="application/json",
)
assert put_resp.status_code == 200
# GET should return int, not string
- verify_resp = authenticated_client.get(
- f"{SETTINGS_PREFIX}/api/search.iterations"
- )
+ verify_resp = authenticated_client.get(f"{SETTINGS_PREFIX}/api/{key}")
assert verify_resp.status_code == 200
stored_value = verify_resp.get_json()["value"]
assert stored_value == 999
@@ -1002,33 +1011,41 @@ class TestApiUpdateSettingTypeConversion:
# Restore original value
authenticated_client.put(
- f"{SETTINGS_PREFIX}/api/search.iterations",
- json={"value": original["value"]},
+ f"{SETTINGS_PREFIX}/api/{key}",
+ json={"value": original_value},
content_type="application/json",
)
def test_put_string_bool_stored_as_bool(self, authenticated_client):
"""PUT string "true" for checkbox setting -> GET returns bool True."""
- # Find a checkbox setting that exists in defaults
- get_resp = authenticated_client.get(
- f"{SETTINGS_PREFIX}/api/app.enable_notifications"
- )
- assert get_resp.status_code == 200
- original = get_resp.get_json()
- assert original["ui_element"] == "checkbox"
+ # Find a checkbox setting dynamically since specific keys may
+ # not be seeded in the test database
+ all_resp = authenticated_client.get(f"{SETTINGS_PREFIX}/api/all")
+ assert all_resp.status_code == 200
+ all_settings = all_resp.get_json()
+
+ checkbox_setting = None
+ for s in all_settings:
+ if s.get("ui_element") == "checkbox" and s.get("editable", True):
+ checkbox_setting = s
+ break
+
+ if checkbox_setting is None:
+ pytest.skip("No editable checkbox setting found in test database")
+
+ key = checkbox_setting["key"]
+ original_value = checkbox_setting["value"]
# PUT string "true"
put_resp = authenticated_client.put(
- f"{SETTINGS_PREFIX}/api/app.enable_notifications",
+ f"{SETTINGS_PREFIX}/api/{key}",
json={"value": "true"},
content_type="application/json",
)
assert put_resp.status_code == 200
# GET should return bool, not string
- verify_resp = authenticated_client.get(
- f"{SETTINGS_PREFIX}/api/app.enable_notifications"
- )
+ verify_resp = authenticated_client.get(f"{SETTINGS_PREFIX}/api/{key}")
assert verify_resp.status_code == 200
stored_value = verify_resp.get_json()["value"]
assert stored_value is True
@@ -1036,7 +1053,7 @@ class TestApiUpdateSettingTypeConversion:
# Restore original value
authenticated_client.put(
- f"{SETTINGS_PREFIX}/api/app.enable_notifications",
- json={"value": original["value"]},
+ f"{SETTINGS_PREFIX}/api/{key}",
+ json={"value": original_value},
content_type="application/json",
)