Use DeviceClass Enums in abode tests (#61980)
This commit is contained in:
parent
4f7182a41a
commit
1a594d2a8c
2 changed files with 4 additions and 5 deletions
|
@ -2,8 +2,8 @@
|
||||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||||
from homeassistant.components.abode.const import ATTRIBUTION
|
from homeassistant.components.abode.const import ATTRIBUTION
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_WINDOW,
|
|
||||||
DOMAIN as BINARY_SENSOR_DOMAIN,
|
DOMAIN as BINARY_SENSOR_DOMAIN,
|
||||||
|
BinarySensorDeviceClass,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
|
@ -37,4 +37,4 @@ async def test_attributes(hass):
|
||||||
assert not state.attributes.get("no_response")
|
assert not state.attributes.get("no_response")
|
||||||
assert state.attributes.get("device_type") == "Door Contact"
|
assert state.attributes.get("device_type") == "Door Contact"
|
||||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Front Door"
|
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Front Door"
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_WINDOW
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == BinarySensorDeviceClass.WINDOW
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
"""Tests for the Abode sensor device."""
|
"""Tests for the Abode sensor device."""
|
||||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorDeviceClass
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
|
@ -35,7 +34,7 @@ async def test_attributes(hass):
|
||||||
assert state.attributes.get("device_type") == "LM"
|
assert state.attributes.get("device_type") == "LM"
|
||||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Environment Sensor Humidity"
|
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Environment Sensor Humidity"
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_HUMIDITY
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.HUMIDITY
|
||||||
|
|
||||||
state = hass.states.get("sensor.environment_sensor_lux")
|
state = hass.states.get("sensor.environment_sensor_lux")
|
||||||
assert state.state == "1.0"
|
assert state.state == "1.0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue