Remove deprecated hass.components from system_health tests (#114207)

This commit is contained in:
Jan-Philipp Benecke 2024-03-25 23:39:31 +01:00 committed by GitHub
parent 18174ad47d
commit 2f0cfc8b61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,7 @@ from unittest.mock import AsyncMock, Mock, patch
from aiohttp.client_exceptions import ClientError from aiohttp.client_exceptions import ClientError
from homeassistant.components import system_health from homeassistant.components import system_health
from homeassistant.components.system_health import async_register_info
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component from homeassistant.setup import async_setup_component
@ -74,7 +75,7 @@ async def test_info_endpoint_register_callback(
async def mock_info(hass): async def mock_info(hass):
return {"storage": "YAML"} return {"storage": "YAML"}
hass.components.system_health.async_register_info("lovelace", mock_info) async_register_info(hass, "lovelace", mock_info)
assert await async_setup_component(hass, "system_health", {}) assert await async_setup_component(hass, "system_health", {})
data = await gather_system_health_info(hass, hass_ws_client) data = await gather_system_health_info(hass, hass_ws_client)
@ -94,7 +95,7 @@ async def test_info_endpoint_register_callback_timeout(
async def mock_info(hass): async def mock_info(hass):
raise TimeoutError raise TimeoutError
hass.components.system_health.async_register_info("lovelace", mock_info) async_register_info(hass, "lovelace", mock_info)
assert await async_setup_component(hass, "system_health", {}) assert await async_setup_component(hass, "system_health", {})
data = await gather_system_health_info(hass, hass_ws_client) data = await gather_system_health_info(hass, hass_ws_client)
@ -111,7 +112,7 @@ async def test_info_endpoint_register_callback_exc(
async def mock_info(hass): async def mock_info(hass):
raise Exception("TEST ERROR") raise Exception("TEST ERROR")
hass.components.system_health.async_register_info("lovelace", mock_info) async_register_info(hass, "lovelace", mock_info)
assert await async_setup_component(hass, "system_health", {}) assert await async_setup_component(hass, "system_health", {})
data = await gather_system_health_info(hass, hass_ws_client) data = await gather_system_health_info(hass, hass_ws_client)