Use service_calls fixture in deconz tests (#120905)

This commit is contained in:
epenet 2024-07-01 10:33:31 +02:00 committed by GitHub
parent d5d77db4f9
commit 88583149ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,7 +34,7 @@ from homeassistant.setup import async_setup_component
from .test_gateway import DECONZ_WEB_REQUEST, setup_deconz_integration
from tests.common import async_get_device_automations, async_mock_service
from tests.common import async_get_device_automations
from tests.test_util.aiohttp import AiohttpClientMocker
@ -43,12 +43,6 @@ def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
"""Stub copying the blueprints to the config folder."""
@pytest.fixture
def automation_calls(hass: HomeAssistant) -> list[ServiceCall]:
"""Track automation calls to a mock service."""
return async_mock_service(hass, "test", "automation")
async def test_get_triggers(
hass: HomeAssistant,
device_registry: dr.DeviceRegistry,
@ -300,7 +294,7 @@ async def test_functional_device_trigger(
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
mock_deconz_websocket,
automation_calls: list[ServiceCall],
service_calls: list[ServiceCall],
device_registry: dr.DeviceRegistry,
) -> None:
"""Test proper matching and attachment of device trigger automation."""
@ -369,8 +363,8 @@ async def test_functional_device_trigger(
await mock_deconz_websocket(data=event_changed_sensor)
await hass.async_block_till_done()
assert len(automation_calls) == 1
assert automation_calls[0].data["some"] == "test_trigger_button_press"
assert len(service_calls) == 1
assert service_calls[0].data["some"] == "test_trigger_button_press"
@pytest.mark.skip(reason="Temporarily disabled until automation validation is improved")