From 92cadb4c5534d6fc66dc05dcd37a0ca105140b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= Date: Thu, 27 Mar 2025 15:03:57 +0100 Subject: [PATCH] Fix /supervisor/reload after refactoring (#5791) As discussed in [1], refactoring in #5759 changed signature of the reload method and CLI now gets unexpected schema when `ha su reload` is called. Change the method to return None as before and add a test for a proper body content. [1] https://github.com/home-assistant/supervisor/pull/5759/files#diff-1b4ed26f31e52ff5fe53efdc695eebacb1e46411f23cce58295591b2b20cd3faR238 --- supervisor/api/supervisor.py | 4 ++-- tests/api/test_supervisor.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/supervisor/api/supervisor.py b/supervisor/api/supervisor.py index 907b11e2f..c17037e1f 100644 --- a/supervisor/api/supervisor.py +++ b/supervisor/api/supervisor.py @@ -230,9 +230,9 @@ class APISupervisor(CoreSysAttributes): await asyncio.shield(self.sys_supervisor.update(version)) @api_process - def reload(self, request: web.Request) -> Awaitable: + async def reload(self, request: web.Request) -> None: """Reload add-ons, configuration, etc.""" - return asyncio.gather( + await asyncio.gather( asyncio.shield(self.sys_updater.reload()), asyncio.shield(self.sys_homeassistant.secrets.reload()), asyncio.shield(self.sys_resolution.evaluate.evaluate_system()), diff --git a/tests/api/test_supervisor.py b/tests/api/test_supervisor.py index 65993b2c5..b2a5634fa 100644 --- a/tests/api/test_supervisor.py +++ b/tests/api/test_supervisor.py @@ -235,6 +235,7 @@ async def test_api_supervisor_reload(api_client: TestClient): """Test supervisor reload.""" resp = await api_client.post("/supervisor/reload") assert resp.status == 200 + assert await resp.json() == {"result": "ok", "data": {}} async def test_api_supervisor_options_timezone(