mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Use DeviceClass Enums in devolo_home_network tests (#62117)
This commit is contained in:
parent
bae82d76b5
commit
ac0f655fd6
@ -8,10 +8,11 @@ from homeassistant.components.devolo_home_network.const import (
|
|||||||
LONG_UPDATE_INTERVAL,
|
LONG_UPDATE_INTERVAL,
|
||||||
SHORT_UPDATE_INTERVAL,
|
SHORT_UPDATE_INTERVAL,
|
||||||
)
|
)
|
||||||
from homeassistant.components.sensor import DOMAIN, STATE_CLASS_MEASUREMENT
|
from homeassistant.components.sensor import DOMAIN, SensorStateClass
|
||||||
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC, STATE_UNAVAILABLE
|
from homeassistant.const import STATE_UNAVAILABLE
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry
|
from homeassistant.helpers import entity_registry
|
||||||
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
from homeassistant.util import dt
|
from homeassistant.util import dt
|
||||||
|
|
||||||
from . import configure_integration
|
from . import configure_integration
|
||||||
@ -47,7 +48,7 @@ async def test_update_connected_wifi_clients(hass: HomeAssistant):
|
|||||||
state = hass.states.get(state_key)
|
state = hass.states.get(state_key)
|
||||||
assert state is not None
|
assert state is not None
|
||||||
assert state.state == "1"
|
assert state.state == "1"
|
||||||
assert state.attributes["state_class"] == STATE_CLASS_MEASUREMENT
|
assert state.attributes["state_class"] == SensorStateClass.MEASUREMENT
|
||||||
|
|
||||||
# Emulate device failure
|
# Emulate device failure
|
||||||
with patch(
|
with patch(
|
||||||
@ -89,7 +90,7 @@ async def test_update_neighboring_wifi_networks(hass: HomeAssistant):
|
|||||||
assert state.state == "1"
|
assert state.state == "1"
|
||||||
|
|
||||||
er = entity_registry.async_get(hass)
|
er = entity_registry.async_get(hass)
|
||||||
assert er.async_get(state_key).entity_category == ENTITY_CATEGORY_DIAGNOSTIC
|
assert er.async_get(state_key).entity_category is EntityCategory.DIAGNOSTIC
|
||||||
|
|
||||||
# Emulate device failure
|
# Emulate device failure
|
||||||
with patch(
|
with patch(
|
||||||
@ -131,7 +132,7 @@ async def test_update_connected_plc_devices(hass: HomeAssistant):
|
|||||||
assert state.state == "1"
|
assert state.state == "1"
|
||||||
|
|
||||||
er = entity_registry.async_get(hass)
|
er = entity_registry.async_get(hass)
|
||||||
assert er.async_get(state_key).entity_category == ENTITY_CATEGORY_DIAGNOSTIC
|
assert er.async_get(state_key).entity_category is EntityCategory.DIAGNOSTIC
|
||||||
|
|
||||||
# Emulate device failure
|
# Emulate device failure
|
||||||
with patch(
|
with patch(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user