Use new enums in modern_forms tests (#62519)

pull/62585/head
Dave T 2021-12-22 09:04:12 +00:00 committed by GitHub
parent e64352a7e0
commit 563e6b3e80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,8 @@
"""Tests for the Modern Forms sensor platform."""
from datetime import datetime
from homeassistant.const import ATTR_DEVICE_CLASS, ATTR_ICON, DEVICE_CLASS_TIMESTAMP
from homeassistant.components.sensor import SensorDeviceClass
from homeassistant.const import ATTR_DEVICE_CLASS, ATTR_ICON
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
@ -22,14 +23,14 @@ async def test_sensors(
state = hass.states.get("sensor.modernformsfan_light_sleep_time")
assert state
assert state.attributes.get(ATTR_ICON) == "mdi:timer-outline"
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TIMESTAMP
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP
assert state.state == "unknown"
# Fan timer remaining time
state = hass.states.get("sensor.modernformsfan_fan_sleep_time")
assert state
assert state.attributes.get(ATTR_ICON) == "mdi:timer-outline"
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TIMESTAMP
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP
assert state.state == "unknown"
@ -46,12 +47,12 @@ async def test_active_sensors(
state = hass.states.get("sensor.modernformsfan_light_sleep_time")
assert state
assert state.attributes.get(ATTR_ICON) == "mdi:timer-outline"
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TIMESTAMP
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP
datetime.fromisoformat(state.state)
# Fan timer remaining time
state = hass.states.get("sensor.modernformsfan_fan_sleep_time")
assert state
assert state.attributes.get(ATTR_ICON) == "mdi:timer-outline"
assert state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TIMESTAMP
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP
datetime.fromisoformat(state.state)