mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Use real devices in cover device action tests (#102719)
This commit is contained in:
parent
8da421c442
commit
21d0fa640f
@ -351,11 +351,20 @@ async def test_get_action_capabilities_set_tilt_pos(
|
|||||||
|
|
||||||
async def test_action(
|
async def test_action(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
enable_custom_integrations: None,
|
enable_custom_integrations: None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test for cover actions."""
|
"""Test for cover 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,
|
||||||
@ -366,7 +375,7 @@ async def test_action(
|
|||||||
"trigger": {"platform": "event", "event_type": "test_event_open"},
|
"trigger": {"platform": "event", "event_type": "test_event_open"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "open",
|
"type": "open",
|
||||||
},
|
},
|
||||||
@ -375,7 +384,7 @@ async def test_action(
|
|||||||
"trigger": {"platform": "event", "event_type": "test_event_close"},
|
"trigger": {"platform": "event", "event_type": "test_event_close"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "close",
|
"type": "close",
|
||||||
},
|
},
|
||||||
@ -384,7 +393,7 @@ async def test_action(
|
|||||||
"trigger": {"platform": "event", "event_type": "test_event_stop"},
|
"trigger": {"platform": "event", "event_type": "test_event_stop"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "stop",
|
"type": "stop",
|
||||||
},
|
},
|
||||||
@ -429,11 +438,20 @@ async def test_action(
|
|||||||
|
|
||||||
async def test_action_legacy(
|
async def test_action_legacy(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
enable_custom_integrations: None,
|
enable_custom_integrations: None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test for cover actions."""
|
"""Test for cover 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,
|
||||||
@ -444,7 +462,7 @@ async def test_action_legacy(
|
|||||||
"trigger": {"platform": "event", "event_type": "test_event_open"},
|
"trigger": {"platform": "event", "event_type": "test_event_open"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "open",
|
"type": "open",
|
||||||
},
|
},
|
||||||
@ -467,11 +485,20 @@ async def test_action_legacy(
|
|||||||
|
|
||||||
async def test_action_tilt(
|
async def test_action_tilt(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
enable_custom_integrations: None,
|
enable_custom_integrations: None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test for cover tilt actions."""
|
"""Test for cover tilt 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,
|
||||||
@ -482,7 +509,7 @@ async def test_action_tilt(
|
|||||||
"trigger": {"platform": "event", "event_type": "test_event_open"},
|
"trigger": {"platform": "event", "event_type": "test_event_open"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "open_tilt",
|
"type": "open_tilt",
|
||||||
},
|
},
|
||||||
@ -491,7 +518,7 @@ async def test_action_tilt(
|
|||||||
"trigger": {"platform": "event", "event_type": "test_event_close"},
|
"trigger": {"platform": "event", "event_type": "test_event_close"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "close_tilt",
|
"type": "close_tilt",
|
||||||
},
|
},
|
||||||
@ -529,11 +556,20 @@ async def test_action_tilt(
|
|||||||
|
|
||||||
async def test_action_set_position(
|
async def test_action_set_position(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
enable_custom_integrations: None,
|
enable_custom_integrations: None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test for cover set position actions."""
|
"""Test for cover set position 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,
|
||||||
@ -547,7 +583,7 @@ async def test_action_set_position(
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "set_position",
|
"type": "set_position",
|
||||||
"position": 25,
|
"position": 25,
|
||||||
@ -560,7 +596,7 @@ async def test_action_set_position(
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "set_tilt_position",
|
"type": "set_tilt_position",
|
||||||
"position": 75,
|
"position": 75,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user