diff --git a/tests/components/webostv/test_device_trigger.py b/tests/components/webostv/test_device_trigger.py index 1349c0670e4..29c75d4440b 100644 --- a/tests/components/webostv/test_device_trigger.py +++ b/tests/components/webostv/test_device_trigger.py @@ -11,7 +11,7 @@ from homeassistant.components.webostv import DOMAIN, device_trigger from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.exceptions import HomeAssistantError -from homeassistant.helpers.device_registry import async_get as get_dev_reg +from homeassistant.helpers import device_registry as dr from homeassistant.setup import async_setup_component from . import setup_webostv @@ -20,12 +20,13 @@ from .const import ENTITY_ID, FAKE_UUID from tests.common import MockConfigEntry, async_get_device_automations -async def test_get_triggers(hass: HomeAssistant, client) -> None: +async def test_get_triggers( + hass: HomeAssistant, device_registry: dr.DeviceRegistry, client +) -> None: """Test we get the expected triggers.""" await setup_webostv(hass) - device_reg = get_dev_reg(hass) - device = device_reg.async_get_device(identifiers={(DOMAIN, FAKE_UUID)}) + device = device_registry.async_get_device(identifiers={(DOMAIN, FAKE_UUID)}) turn_on_trigger = { "platform": "device", @@ -42,13 +43,15 @@ async def test_get_triggers(hass: HomeAssistant, client) -> None: async def test_if_fires_on_turn_on_request( - hass: HomeAssistant, calls: list[ServiceCall], client + hass: HomeAssistant, + calls: list[ServiceCall], + device_registry: dr.DeviceRegistry, + client, ) -> None: """Test for turn_on and turn_off triggers firing.""" await setup_webostv(hass) - device_reg = get_dev_reg(hass) - device = device_reg.async_get_device(identifiers={(DOMAIN, FAKE_UUID)}) + device = device_registry.async_get_device(identifiers={(DOMAIN, FAKE_UUID)}) assert await async_setup_component( hass, @@ -101,7 +104,9 @@ async def test_if_fires_on_turn_on_request( assert calls[1].data["id"] == 0 -async def test_failure_scenarios(hass: HomeAssistant, client) -> None: +async def test_failure_scenarios( + hass: HomeAssistant, device_registry: dr.DeviceRegistry, client +) -> None: """Test failure scenarios.""" await setup_webostv(hass) @@ -125,9 +130,8 @@ async def test_failure_scenarios(hass: HomeAssistant, client) -> None: entry = MockConfigEntry(domain="fake", state=ConfigEntryState.LOADED, data={}) entry.add_to_hass(hass) - device_reg = get_dev_reg(hass) - device = device_reg.async_get_or_create( + device = device_registry.async_get_or_create( config_entry_id=entry.entry_id, identifiers={("fake", "fake")} ) diff --git a/tests/components/webostv/test_trigger.py b/tests/components/webostv/test_trigger.py index 05fde697752..918666cf4bf 100644 --- a/tests/components/webostv/test_trigger.py +++ b/tests/components/webostv/test_trigger.py @@ -9,7 +9,7 @@ from homeassistant.components.webostv import DOMAIN from homeassistant.const import SERVICE_RELOAD from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.exceptions import HomeAssistantError -from homeassistant.helpers.device_registry import async_get as get_dev_reg +from homeassistant.helpers import device_registry as dr from homeassistant.setup import async_setup_component from . import setup_webostv @@ -19,13 +19,15 @@ from tests.common import MockEntity, MockEntityPlatform async def test_webostv_turn_on_trigger_device_id( - hass: HomeAssistant, calls: list[ServiceCall], client + hass: HomeAssistant, + calls: list[ServiceCall], + device_registry: dr.DeviceRegistry, + client, ) -> None: """Test for turn_on triggers by device_id firing.""" await setup_webostv(hass) - device_reg = get_dev_reg(hass) - device = device_reg.async_get_device(identifiers={(DOMAIN, FAKE_UUID)}) + device = device_registry.async_get_device(identifiers={(DOMAIN, FAKE_UUID)}) assert await async_setup_component( hass,