From 3c9e473823279a5029974052f970558992c9f9fe Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 17 Apr 2026 14:49:33 -0400 Subject: [PATCH] fix(tests): mock get_setting in calendar tools availability test The rss_enabled check in _check_requires now calls get_setting, which needs a database connection. Mock it in the test that exercises get_tools_for_user. Co-Authored-By: Claude Opus 4.6 --- tests/test_events_service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_events_service.py b/tests/test_events_service.py index dbb86f8..73d05ff 100644 --- a/tests/test_events_service.py +++ b/tests/test_events_service.py @@ -127,8 +127,10 @@ async def test_update_event_fires_caldav_push(): @pytest.mark.asyncio async def test_tools_calendar_always_available(): """Calendar tools must appear in get_tools_for_user even without CalDAV.""" - with patch("fabledassistant.services.tools._registry.is_caldav_configured", new_callable=AsyncMock) as mock_configured: + with patch("fabledassistant.services.tools._registry.is_caldav_configured", new_callable=AsyncMock) as mock_configured, \ + patch("fabledassistant.services.tools._registry.get_setting", new_callable=AsyncMock) as mock_setting: mock_configured.return_value = False + mock_setting.return_value = "false" from fabledassistant.services.tools import get_tools_for_user tools = await get_tools_for_user(user_id=1) tool_names = {t["function"]["name"] for t in tools}