Use more state attribute name constants (#40428)

This commit is contained in:
Ville Skyttä authored and GitHub committed 2020-09-21 23:03:39 +02:00
1 parent f78391ce2a
commit 5e90a4d000
36 files changed
+231 -156

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
"""The sensor tests for the august platform."""
from homeassistant.const import PERCENTAGE, STATE_UNAVAILABLE
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, PERCENTAGE, STATE_UNAVAILABLE
from tests.components.august.mocks import (
_create_august_with_devices,
@@ -75,7 +75,7 @@ async def test_create_lock_with_linked_keypad(hass):
state = hass.states.get("sensor.front_door_lock_keypad_battery")
assert state.state == "60"
assert state.attributes["unit_of_measurement"] == PERCENTAGE
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == PERCENTAGE
entry = entity_registry.async_get("sensor.front_door_lock_keypad_battery")
assert entry
assert entry.unique_id == "5bc65c24e6ef2a263e1450a8_linked_keypad_battery"
@@ -105,7 +105,7 @@ async def test_create_lock_with_low_battery_linked_keypad(hass):
state = hass.states.get("sensor.front_door_lock_keypad_battery")
assert state.state == "10"
assert state.attributes["unit_of_measurement"] == PERCENTAGE
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == PERCENTAGE
entry = entity_registry.async_get("sensor.front_door_lock_keypad_battery")
assert entry
assert entry.unique_id == "5bc65c24e6ef2a263e1450a8_linked_keypad_battery"