Use real devices in vacuum device action tests (#102729)
parent
02a83740cc
commit
e1394d720f
|
@ -102,9 +102,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 turn_on and turn_off actions."""
|
"""Test for turn_on and turn_off 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
|
||||||
|
)
|
||||||
|
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass,
|
hass,
|
||||||
|
@ -115,7 +127,7 @@ async def test_action(hass: HomeAssistant, entity_registry: er.EntityRegistry) -
|
||||||
"trigger": {"platform": "event", "event_type": "test_event_dock"},
|
"trigger": {"platform": "event", "event_type": "test_event_dock"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "dock",
|
"type": "dock",
|
||||||
},
|
},
|
||||||
|
@ -124,7 +136,7 @@ async def test_action(hass: HomeAssistant, entity_registry: er.EntityRegistry) -
|
||||||
"trigger": {"platform": "event", "event_type": "test_event_clean"},
|
"trigger": {"platform": "event", "event_type": "test_event_clean"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "clean",
|
"type": "clean",
|
||||||
},
|
},
|
||||||
|
@ -151,10 +163,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 turn_on and turn_off actions."""
|
"""Test for turn_on and turn_off 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
|
||||||
|
)
|
||||||
|
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass,
|
hass,
|
||||||
|
@ -165,7 +187,7 @@ async def test_action_legacy(
|
||||||
"trigger": {"platform": "event", "event_type": "test_event_dock"},
|
"trigger": {"platform": "event", "event_type": "test_event_dock"},
|
||||||
"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": "dock",
|
"type": "dock",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue