From 6f0134105559a72916f1bb0982d6e36392c50b49 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 2 Nov 2023 13:21:54 +0100 Subject: [PATCH] Fix Home Assistant Core API check (#4663) * Fix Home Assistant Core API check * Remove check_api_state mock to improve test coverage --- supervisor/homeassistant/api.py | 2 +- tests/conftest.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/supervisor/homeassistant/api.py b/supervisor/homeassistant/api.py index feb604214..b0d099b1c 100644 --- a/supervisor/homeassistant/api.py +++ b/supervisor/homeassistant/api.py @@ -164,6 +164,6 @@ class HomeAssistantAPI(CoreSysAttributes): async def check_api_state(self) -> bool: """Return Home Assistant Core state if up.""" - if state := self.get_api_state(): + if state := await self.get_api_state(): return state == "RUNNING" return False diff --git a/tests/conftest.py b/tests/conftest.py index 86c3a531e..140b5080c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -353,7 +353,6 @@ async def coresys( ) # WebSocket - coresys_obj.homeassistant.api.check_api_state = AsyncMock(return_value=True) coresys_obj.homeassistant.api.get_api_state = AsyncMock(return_value="RUNNING") coresys_obj.homeassistant._websocket._client = AsyncMock( ha_version=AwesomeVersion("2021.2.4")