mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Use real devices in climate device action tests (#102718)
This commit is contained in:
parent
4bb6787909
commit
8da421c442
@ -143,9 +143,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,
|
||||||
@ -168,7 +180,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_hvac_mode",
|
"type": "set_hvac_mode",
|
||||||
"hvac_mode": HVACMode.OFF,
|
"hvac_mode": HVACMode.OFF,
|
||||||
@ -181,7 +193,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_preset_mode",
|
"type": "set_preset_mode",
|
||||||
"preset_mode": const.PRESET_AWAY,
|
"preset_mode": const.PRESET_AWAY,
|
||||||
@ -219,10 +231,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,
|
||||||
@ -245,7 +267,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_hvac_mode",
|
"type": "set_hvac_mode",
|
||||||
"hvac_mode": HVACMode.OFF,
|
"hvac_mode": HVACMode.OFF,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user