|
9 | 9 | from homeassistant.helpers import device_registry as dr, entity_registry as er
|
10 | 10 | from homeassistant.setup import async_setup_component
|
11 | 11 |
|
12 |
| -from tests.common import ( |
13 |
| - MockConfigEntry, |
14 |
| - async_get_device_automations, |
15 |
| - async_mock_service, |
16 |
| -) |
| 12 | +from tests.common import MockConfigEntry, async_get_device_automations |
17 | 13 |
|
18 | 14 |
|
19 | 15 | @pytest.fixture(autouse=True, name="stub_blueprint_populate")
|
20 | 16 | def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
|
21 | 17 | """Stub copying the blueprints to the config folder."""
|
22 | 18 |
|
23 | 19 |
|
24 |
| -@pytest.fixture |
25 |
| -def calls(hass: HomeAssistant) -> list[ServiceCall]: |
26 |
| - """Track calls to a mock service.""" |
27 |
| - return async_mock_service(hass, "test", "automation") |
28 |
| - |
29 |
| - |
30 | 20 | async def test_get_triggers(
|
31 | 21 | hass: HomeAssistant,
|
32 | 22 | device_registry: dr.DeviceRegistry,
|
@@ -69,7 +59,7 @@ async def test_get_triggers(
|
69 | 59 | async def test_if_fires_on_turn_on_request(
|
70 | 60 | hass: HomeAssistant,
|
71 | 61 | entity_registry: er.EntityRegistry,
|
72 |
| - calls: list[ServiceCall], |
| 62 | + service_calls: list[ServiceCall], |
73 | 63 | player_setup,
|
74 | 64 | state,
|
75 | 65 | ) -> None:
|
@@ -111,15 +101,15 @@ async def test_if_fires_on_turn_on_request(
|
111 | 101 | )
|
112 | 102 |
|
113 | 103 | await hass.async_block_till_done()
|
114 |
| - assert len(calls) == 1 |
115 |
| - assert calls[0].data["some"] == player_setup |
116 |
| - assert calls[0].data["id"] == 0 |
| 104 | + assert len(service_calls) == 2 |
| 105 | + assert service_calls[1].data["some"] == player_setup |
| 106 | + assert service_calls[1].data["id"] == 0 |
117 | 107 |
|
118 | 108 |
|
119 | 109 | async def test_if_fires_on_turn_on_request_legacy(
|
120 | 110 | hass: HomeAssistant,
|
121 | 111 | entity_registry: er.EntityRegistry,
|
122 |
| - calls: list[ServiceCall], |
| 112 | + service_calls: list[ServiceCall], |
123 | 113 | player_setup,
|
124 | 114 | state,
|
125 | 115 | ) -> None:
|
@@ -161,6 +151,6 @@ async def test_if_fires_on_turn_on_request_legacy(
|
161 | 151 | )
|
162 | 152 |
|
163 | 153 | await hass.async_block_till_done()
|
164 |
| - assert len(calls) == 1 |
165 |
| - assert calls[0].data["some"] == player_setup |
166 |
| - assert calls[0].data["id"] == 0 |
| 154 | + assert len(service_calls) == 2 |
| 155 | + assert service_calls[1].data["some"] == player_setup |
| 156 | + assert service_calls[1].data["id"] == 0 |
0 commit comments