mirror of https://github.com/home-assistant/core
Fix accuweather system_health after data change (#116063)
This commit is contained in:
parent
bcc2dd99b2
commit
5bded2a52d
|
@ -24,7 +24,7 @@ async def system_health_info(hass: HomeAssistant) -> dict[str, Any]:
|
|||
"""Get info for the info page."""
|
||||
remaining_requests = list(hass.data[DOMAIN].values())[
|
||||
0
|
||||
].accuweather.requests_remaining
|
||||
].coordinator_observation.accuweather.requests_remaining
|
||||
|
||||
return {
|
||||
"can_reach_server": system_health.async_check_can_reach_url(hass, ENDPOINT),
|
||||
|
|
|
@ -5,6 +5,7 @@ from unittest.mock import Mock
|
|||
|
||||
from aiohttp import ClientError
|
||||
|
||||
from homeassistant.components.accuweather import AccuWeatherData
|
||||
from homeassistant.components.accuweather.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
@ -23,8 +24,10 @@ async def test_accuweather_system_health(
|
|||
await hass.async_block_till_done()
|
||||
|
||||
hass.data[DOMAIN] = {}
|
||||
hass.data[DOMAIN]["0123xyz"] = {}
|
||||
hass.data[DOMAIN]["0123xyz"] = Mock(accuweather=Mock(requests_remaining="42"))
|
||||
hass.data[DOMAIN]["0123xyz"] = AccuWeatherData(
|
||||
coordinator_observation=Mock(accuweather=Mock(requests_remaining="42")),
|
||||
coordinator_daily_forecast=Mock(),
|
||||
)
|
||||
|
||||
info = await get_system_health_info(hass, DOMAIN)
|
||||
|
||||
|
@ -48,8 +51,10 @@ async def test_accuweather_system_health_fail(
|
|||
await hass.async_block_till_done()
|
||||
|
||||
hass.data[DOMAIN] = {}
|
||||
hass.data[DOMAIN]["0123xyz"] = {}
|
||||
hass.data[DOMAIN]["0123xyz"] = Mock(accuweather=Mock(requests_remaining="0"))
|
||||
hass.data[DOMAIN]["0123xyz"] = AccuWeatherData(
|
||||
coordinator_observation=Mock(accuweather=Mock(requests_remaining="0")),
|
||||
coordinator_daily_forecast=Mock(),
|
||||
)
|
||||
|
||||
info = await get_system_health_info(hass, DOMAIN)
|
||||
|
||||
|
|
Loading…
Reference in New Issue