"""GET/PUT /api/v1/settings/ui""" from app.models.ui_settings import UI_SETTINGS_ROW_ID, UiSettings def test_get_ui_settings_default(jwt_headers, client): response = client.get("/api/v1/settings/ui", headers=jwt_headers) assert response.status_code == 200 body = response.json() assert body["show_sidebar_system_stats"] is True assert body["source"] == "default" def test_put_ui_settings_persists(jwt_headers, client, db_session): response = client.put( "/api/v1/settings/ui", headers=jwt_headers, json={"show_sidebar_system_stats": False}, ) assert response.status_code == 200 body = response.json() assert body["show_sidebar_system_stats"] is False assert body["source"] == "db" row = db_session.get(UiSettings, UI_SETTINGS_ROW_ID) assert row is not None assert row.show_sidebar_system_stats is False def test_ui_settings_requires_admin(jwt_monitor_headers, client): response = client.get("/api/v1/settings/ui", headers=jwt_monitor_headers) assert response.status_code == 403