Use DeviceAutomationType in tests/components/[h-l]* (#62441)

This commit is contained in:
Ville Skyttä 2021-12-20 23:18:53 +02:00 committed by GitHub
parent ce93364a36
commit c5e6489475
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 108 additions and 30 deletions

View file

@ -7,6 +7,7 @@ service-label-index despite not being linked to a service-label.
https://github.com/home-assistant/core/pull/39090
"""
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.helpers import entity_registry as er
from tests.common import assert_lists_same, async_get_device_automations
@ -50,5 +51,7 @@ async def test_aqara_switch_setup(hass):
}
)
triggers = await async_get_device_automations(hass, "trigger", battery.device_id)
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, battery.device_id
)
assert_lists_same(triggers, expected)

View file

@ -1,5 +1,6 @@
"""Tests for handling accessories on a Hue bridge via HomeKit."""
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.helpers import device_registry as dr, entity_registry as er
from tests.common import assert_lists_same, async_get_device_automations
@ -63,5 +64,7 @@ async def test_hue_bridge_setup(hass):
}
)
triggers = await async_get_device_automations(hass, "trigger", device.id)
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, device.id
)
assert_lists_same(triggers, expected)

View file

@ -1,5 +1,6 @@
"""Make sure that handling real world LG HomeKit characteristics isn't broken."""
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.media_player.const import (
SUPPORT_PAUSE,
SUPPORT_PLAY,
@ -66,6 +67,8 @@ async def test_lg_tv(hass):
assert device.hw_version == "1"
# A TV has media player device triggers
triggers = await async_get_device_automations(hass, "trigger", device.id)
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, device.id
)
for trigger in triggers:
assert trigger["domain"] == "media_player"

View file

@ -4,6 +4,7 @@ Regression tests for Netamo Doorbell.
https://github.com/home-assistant/core/issues/44596
"""
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.helpers import device_registry as dr, entity_registry as er
from tests.common import assert_lists_same, async_get_device_automations
@ -69,5 +70,7 @@ async def test_netamo_doorbell_setup(hass):
}
)
triggers = await async_get_device_automations(hass, "trigger", doorbell.device_id)
triggers = await async_get_device_automations(
hass, DeviceAutomationType.TRIGGER, doorbell.device_id
)
assert_lists_same(triggers, expected)