Use real devices in humidifier device action tests (#102721)
This commit is contained in:
parent
e1394d720f
commit
2e9a3e8c8e
1 changed files with 32 additions and 10 deletions
|
@ -142,9 +142,21 @@ async def test_get_actions_hidden_auxiliary(
|
||||||
assert actions == unordered(expected_actions)
|
assert actions == unordered(expected_actions)
|
||||||
|
|
||||||
|
|
||||||
async def test_action(hass: HomeAssistant, entity_registry: er.EntityRegistry) -> None:
|
async def test_action(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
) -> None:
|
||||||
"""Test for actions."""
|
"""Test for actions."""
|
||||||
entry = entity_registry.async_get_or_create(DOMAIN, "test", "5678")
|
config_entry = MockConfigEntry(domain="test", data={})
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
|
device_entry = device_registry.async_get_or_create(
|
||||||
|
config_entry_id=config_entry.entry_id,
|
||||||
|
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||||
|
)
|
||||||
|
entry = entity_registry.async_get_or_create(
|
||||||
|
DOMAIN, "test", "5678", device_id=device_entry.id
|
||||||
|
)
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entry.entity_id,
|
entry.entity_id,
|
||||||
|
@ -164,7 +176,7 @@ async def test_action(hass: HomeAssistant, entity_registry: er.EntityRegistry) -
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "turn_off",
|
"type": "turn_off",
|
||||||
},
|
},
|
||||||
|
@ -176,7 +188,7 @@ async def test_action(hass: HomeAssistant, entity_registry: er.EntityRegistry) -
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "turn_on",
|
"type": "turn_on",
|
||||||
},
|
},
|
||||||
|
@ -185,7 +197,7 @@ async def test_action(hass: HomeAssistant, entity_registry: er.EntityRegistry) -
|
||||||
"trigger": {"platform": "event", "event_type": "test_event_toggle"},
|
"trigger": {"platform": "event", "event_type": "test_event_toggle"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "toggle",
|
"type": "toggle",
|
||||||
},
|
},
|
||||||
|
@ -197,7 +209,7 @@ async def test_action(hass: HomeAssistant, entity_registry: er.EntityRegistry) -
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "set_humidity",
|
"type": "set_humidity",
|
||||||
"humidity": 35,
|
"humidity": 35,
|
||||||
|
@ -210,7 +222,7 @@ async def test_action(hass: HomeAssistant, entity_registry: er.EntityRegistry) -
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "set_mode",
|
"type": "set_mode",
|
||||||
"mode": const.MODE_AWAY,
|
"mode": const.MODE_AWAY,
|
||||||
|
@ -290,10 +302,20 @@ async def test_action(hass: HomeAssistant, entity_registry: er.EntityRegistry) -
|
||||||
|
|
||||||
|
|
||||||
async def test_action_legacy(
|
async def test_action_legacy(
|
||||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test for actions."""
|
"""Test for actions."""
|
||||||
entry = entity_registry.async_get_or_create(DOMAIN, "test", "5678")
|
config_entry = MockConfigEntry(domain="test", data={})
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
|
device_entry = device_registry.async_get_or_create(
|
||||||
|
config_entry_id=config_entry.entry_id,
|
||||||
|
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||||
|
)
|
||||||
|
entry = entity_registry.async_get_or_create(
|
||||||
|
DOMAIN, "test", "5678", device_id=device_entry.id
|
||||||
|
)
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entry.entity_id,
|
entry.entity_id,
|
||||||
|
@ -313,7 +335,7 @@ async def test_action_legacy(
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.entity_id,
|
"entity_id": entry.entity_id,
|
||||||
"type": "set_mode",
|
"type": "set_mode",
|
||||||
"mode": const.MODE_AWAY,
|
"mode": const.MODE_AWAY,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue