mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Use real devices in climate device condition tests (#102705)
This commit is contained in:
parent
9d3cdc85ca
commit
bead989e7f
@ -147,10 +147,21 @@ async def test_get_conditions_hidden_auxiliary(
|
|||||||
|
|
||||||
|
|
||||||
async def test_if_state(
|
async def test_if_state(
|
||||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, calls
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
calls,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test for turn_on and turn_off conditions."""
|
"""Test for turn_on and turn_off conditions."""
|
||||||
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,
|
||||||
@ -163,7 +174,7 @@ async def test_if_state(
|
|||||||
{
|
{
|
||||||
"condition": "device",
|
"condition": "device",
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "is_hvac_mode",
|
"type": "is_hvac_mode",
|
||||||
"hvac_mode": "cool",
|
"hvac_mode": "cool",
|
||||||
@ -185,7 +196,7 @@ async def test_if_state(
|
|||||||
{
|
{
|
||||||
"condition": "device",
|
"condition": "device",
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "is_preset_mode",
|
"type": "is_preset_mode",
|
||||||
"preset_mode": "away",
|
"preset_mode": "away",
|
||||||
@ -257,10 +268,21 @@ async def test_if_state(
|
|||||||
|
|
||||||
|
|
||||||
async def test_if_state_legacy(
|
async def test_if_state_legacy(
|
||||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, calls
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
calls,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test for turn_on and turn_off conditions."""
|
"""Test for turn_on and turn_off conditions."""
|
||||||
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,
|
||||||
@ -273,7 +295,7 @@ async def test_if_state_legacy(
|
|||||||
{
|
{
|
||||||
"condition": "device",
|
"condition": "device",
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.entity_id,
|
"entity_id": entry.entity_id,
|
||||||
"type": "is_hvac_mode",
|
"type": "is_hvac_mode",
|
||||||
"hvac_mode": "cool",
|
"hvac_mode": "cool",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user