Skip to content

Commit

Permalink
[Modify] Improve humidifier test
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxn committed Mar 14, 2021
1 parent 366fa53 commit 41c99c6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/dyson_local/test_humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@
from custom_components.dyson_local import DOMAIN
from custom_components.dyson_local.humidifier import (
ATTR_WATER_HARDNESS,
AVAILABLE_MODES,
MAX_HUMIDITY,
MIN_HUMIDITY,
SERVICE_SET_WATER_HARDNESS,
SUPPORTED_FEATURES,
)
from homeassistant.components.humidifier import (
ATTR_AVAILABLE_MODES,
ATTR_HUMIDITY,
ATTR_MAX_HUMIDITY,
ATTR_MIN_HUMIDITY,
ATTR_MODE,
DOMAIN as HUMIDIFIER_DOMAIN,
SERVICE_SET_HUMIDITY,
Expand All @@ -26,7 +33,12 @@
SERVICE_TURN_ON,
)
from homeassistant.components.humidifier.const import MODE_AUTO, MODE_NORMAL
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_SUPPORTED_FEATURES,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry

Expand Down Expand Up @@ -56,8 +68,12 @@ async def test_state(hass: HomeAssistant, device: DysonPureHumidifyCool):
state = hass.states.get(ENTITY_ID)
assert state.state == STATE_ON
attributes = state.attributes
assert attributes[ATTR_AVAILABLE_MODES] == AVAILABLE_MODES
assert attributes[ATTR_MODE] == MODE_AUTO
assert attributes[ATTR_MIN_HUMIDITY] == MIN_HUMIDITY
assert attributes[ATTR_MAX_HUMIDITY] == MAX_HUMIDITY
assert attributes[ATTR_HUMIDITY] == 50
assert attributes[ATTR_SUPPORTED_FEATURES] == SUPPORTED_FEATURES

er = await entity_registry.async_get_registry(hass)
assert er.async_get(ENTITY_ID).unique_id == SERIAL
Expand Down

0 comments on commit 41c99c6

Please sign in to comment.