Clean up async_update_entity helper usage (#68641)

This commit is contained in:
Franck Nijhof 2022-03-25 23:22:58 +01:00 committed by GitHub
parent 53245c6523
commit d645e80ccd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 87 additions and 103 deletions

View file

@ -10,6 +10,7 @@ from homeassistant.const import (
STATE_UNAVAILABLE,
STATE_UNKNOWN,
)
from homeassistant.helpers.entity_component import async_update_entity
from tests.components.dexcom import GLUCOSE_READING, init_integration
@ -36,12 +37,8 @@ async def test_sensors_unknown(hass):
"homeassistant.components.dexcom.Dexcom.get_current_glucose_reading",
return_value=None,
):
await hass.helpers.entity_component.async_update_entity(
"sensor.dexcom_test_username_glucose_value"
)
await hass.helpers.entity_component.async_update_entity(
"sensor.dexcom_test_username_glucose_trend"
)
await async_update_entity(hass, "sensor.dexcom_test_username_glucose_value")
await async_update_entity(hass, "sensor.dexcom_test_username_glucose_trend")
test_username_glucose_value = hass.states.get(
"sensor.dexcom_test_username_glucose_value"
@ -61,12 +58,8 @@ async def test_sensors_update_failed(hass):
"homeassistant.components.dexcom.Dexcom.get_current_glucose_reading",
side_effect=SessionError,
):
await hass.helpers.entity_component.async_update_entity(
"sensor.dexcom_test_username_glucose_value"
)
await hass.helpers.entity_component.async_update_entity(
"sensor.dexcom_test_username_glucose_trend"
)
await async_update_entity(hass, "sensor.dexcom_test_username_glucose_value")
await async_update_entity(hass, "sensor.dexcom_test_username_glucose_trend")
test_username_glucose_value = hass.states.get(
"sensor.dexcom_test_username_glucose_value"