Use service_calls fixture in deconz tests (#120905)
This commit is contained in:
parent
d5d77db4f9
commit
88583149ea
1 changed files with 4 additions and 10 deletions
|
@ -34,7 +34,7 @@ from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from .test_gateway import DECONZ_WEB_REQUEST, setup_deconz_integration
|
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
|
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."""
|
"""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(
|
async def test_get_triggers(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
|
@ -300,7 +294,7 @@ async def test_functional_device_trigger(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
mock_deconz_websocket,
|
mock_deconz_websocket,
|
||||||
automation_calls: list[ServiceCall],
|
service_calls: list[ServiceCall],
|
||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test proper matching and attachment of device trigger automation."""
|
"""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 mock_deconz_websocket(data=event_changed_sensor)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert len(automation_calls) == 1
|
assert len(service_calls) == 1
|
||||||
assert automation_calls[0].data["some"] == "test_trigger_button_press"
|
assert service_calls[0].data["some"] == "test_trigger_button_press"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Temporarily disabled until automation validation is improved")
|
@pytest.mark.skip(reason="Temporarily disabled until automation validation is improved")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue