mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use real devices in alarm_control_panel device action tests (#102716)
This commit is contained in:
parent
2e9a3e8c8e
commit
a4487637ef
@ -426,6 +426,7 @@ async def test_get_action_capabilities_arm_code_legacy(
|
|||||||
|
|
||||||
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:
|
||||||
@ -433,10 +434,17 @@ async def test_action(
|
|||||||
platform = getattr(hass.components, f"test.{DOMAIN}")
|
platform = getattr(hass.components, f"test.{DOMAIN}")
|
||||||
platform.init()
|
platform.init()
|
||||||
|
|
||||||
|
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")},
|
||||||
|
)
|
||||||
entity_entry = entity_registry.async_get_or_create(
|
entity_entry = entity_registry.async_get_or_create(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
"test",
|
"test",
|
||||||
platform.ENTITIES["no_arm_code"].unique_id,
|
platform.ENTITIES["no_arm_code"].unique_id,
|
||||||
|
device_id=device_entry.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
@ -451,7 +459,7 @@ async def test_action(
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entity_entry.id,
|
"entity_id": entity_entry.id,
|
||||||
"type": "arm_away",
|
"type": "arm_away",
|
||||||
},
|
},
|
||||||
@ -463,7 +471,7 @@ async def test_action(
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entity_entry.id,
|
"entity_id": entity_entry.id,
|
||||||
"type": "arm_home",
|
"type": "arm_home",
|
||||||
},
|
},
|
||||||
@ -475,7 +483,7 @@ async def test_action(
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entity_entry.id,
|
"entity_id": entity_entry.id,
|
||||||
"type": "arm_night",
|
"type": "arm_night",
|
||||||
},
|
},
|
||||||
@ -487,7 +495,7 @@ async def test_action(
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entity_entry.id,
|
"entity_id": entity_entry.id,
|
||||||
"type": "arm_vacation",
|
"type": "arm_vacation",
|
||||||
},
|
},
|
||||||
@ -496,7 +504,7 @@ async def test_action(
|
|||||||
"trigger": {"platform": "event", "event_type": "test_event_disarm"},
|
"trigger": {"platform": "event", "event_type": "test_event_disarm"},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entity_entry.id,
|
"entity_id": entity_entry.id,
|
||||||
"type": "disarm",
|
"type": "disarm",
|
||||||
"code": "1234",
|
"code": "1234",
|
||||||
@ -509,7 +517,7 @@ async def test_action(
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entity_entry.id,
|
"entity_id": entity_entry.id,
|
||||||
"type": "trigger",
|
"type": "trigger",
|
||||||
},
|
},
|
||||||
@ -549,6 +557,7 @@ 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:
|
||||||
@ -556,10 +565,17 @@ async def test_action_legacy(
|
|||||||
platform = getattr(hass.components, f"test.{DOMAIN}")
|
platform = getattr(hass.components, f"test.{DOMAIN}")
|
||||||
platform.init()
|
platform.init()
|
||||||
|
|
||||||
|
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")},
|
||||||
|
)
|
||||||
entity_entry = entity_registry.async_get_or_create(
|
entity_entry = entity_registry.async_get_or_create(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
"test",
|
"test",
|
||||||
platform.ENTITIES["no_arm_code"].unique_id,
|
platform.ENTITIES["no_arm_code"].unique_id,
|
||||||
|
device_id=device_entry.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
@ -574,7 +590,7 @@ async def test_action_legacy(
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "abcdefgh",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entity_entry.entity_id,
|
"entity_id": entity_entry.entity_id,
|
||||||
"type": "arm_away",
|
"type": "arm_away",
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user