Fix Home Assistant Core API check (#4663)

* Fix Home Assistant Core API check

* Remove check_api_state mock to improve test coverage
This commit is contained in:
Stefan Agner 2023-11-02 13:21:54 +01:00 committed by GitHub
parent 6762a4153a
commit 6f01341055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 2 deletions

View File

@ -164,6 +164,6 @@ class HomeAssistantAPI(CoreSysAttributes):
async def check_api_state(self) -> bool: async def check_api_state(self) -> bool:
"""Return Home Assistant Core state if up.""" """Return Home Assistant Core state if up."""
if state := self.get_api_state(): if state := await self.get_api_state():
return state == "RUNNING" return state == "RUNNING"
return False return False

View File

@ -353,7 +353,6 @@ async def coresys(
) )
# WebSocket # 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.api.get_api_state = AsyncMock(return_value="RUNNING")
coresys_obj.homeassistant._websocket._client = AsyncMock( coresys_obj.homeassistant._websocket._client = AsyncMock(
ha_version=AwesomeVersion("2021.2.4") ha_version=AwesomeVersion("2021.2.4")