Use real devices in humidifier device trigger tests (#102687)
This commit is contained in:
parent
51f6dac97f
commit
cedade15ef
1 changed files with 36 additions and 14 deletions
|
@ -162,10 +162,21 @@ async def test_get_triggers_hidden_auxiliary(
|
|||
|
||||
|
||||
async def test_if_fires_on_state_change(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, calls
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
calls,
|
||||
) -> None:
|
||||
"""Test for turn_on and turn_off triggers firing."""
|
||||
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(
|
||||
entry.entity_id,
|
||||
|
@ -188,7 +199,7 @@ async def test_if_fires_on_state_change(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.id,
|
||||
"type": "target_humidity_changed",
|
||||
"below": 20,
|
||||
|
@ -202,7 +213,7 @@ async def test_if_fires_on_state_change(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.id,
|
||||
"type": "target_humidity_changed",
|
||||
"above": 30,
|
||||
|
@ -216,7 +227,7 @@ async def test_if_fires_on_state_change(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.id,
|
||||
"type": "target_humidity_changed",
|
||||
"above": 30,
|
||||
|
@ -231,7 +242,7 @@ async def test_if_fires_on_state_change(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.id,
|
||||
"type": "current_humidity_changed",
|
||||
"below": 30,
|
||||
|
@ -245,7 +256,7 @@ async def test_if_fires_on_state_change(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.id,
|
||||
"type": "current_humidity_changed",
|
||||
"above": 40,
|
||||
|
@ -259,7 +270,7 @@ async def test_if_fires_on_state_change(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.id,
|
||||
"type": "current_humidity_changed",
|
||||
"above": 40,
|
||||
|
@ -274,7 +285,7 @@ async def test_if_fires_on_state_change(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.id,
|
||||
"type": "turned_on",
|
||||
},
|
||||
|
@ -298,7 +309,7 @@ async def test_if_fires_on_state_change(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.id,
|
||||
"type": "turned_off",
|
||||
},
|
||||
|
@ -322,7 +333,7 @@ async def test_if_fires_on_state_change(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.id,
|
||||
"type": "changed_states",
|
||||
},
|
||||
|
@ -423,10 +434,21 @@ async def test_if_fires_on_state_change(
|
|||
|
||||
|
||||
async def test_if_fires_on_state_change_legacy(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, calls
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
calls,
|
||||
) -> None:
|
||||
"""Test for turn_on and turn_off triggers firing."""
|
||||
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(
|
||||
entry.entity_id,
|
||||
|
@ -448,7 +470,7 @@ async def test_if_fires_on_state_change_legacy(
|
|||
"trigger": {
|
||||
"platform": "device",
|
||||
"domain": DOMAIN,
|
||||
"device_id": "",
|
||||
"device_id": device_entry.id,
|
||||
"entity_id": entry.entity_id,
|
||||
"type": "target_humidity_changed",
|
||||
"below": 20,
|
||||
|
|
Loading…
Add table
Reference in a new issue