|
13 | 13 | from custom_components.pyscript.const import CONF_ALLOW_ALL_IMPORTS, CONF_HASS_IS_GLOBAL, DOMAIN, FOLDER |
14 | 14 | from custom_components.pyscript.function import Function |
15 | 15 | from homeassistant.const import EVENT_HOMEASSISTANT_STARTED, EVENT_STATE_CHANGED |
16 | | -from homeassistant.core import Context |
| 16 | +from homeassistant.core import Context, ServiceRegistry |
17 | 17 | from homeassistant.setup import async_setup_component |
18 | 18 |
|
19 | 19 |
|
@@ -95,7 +95,7 @@ async def test_func_completions( |
95 | 95 | @pytest.mark.asyncio |
96 | 96 | async def test_service_completions(root, expected, hass, services): # pylint: disable=redefined-outer-name |
97 | 97 | """Test service name completion.""" |
98 | | - with patch.object(hass.services, "async_services", return_value=services), patch.object( |
| 98 | + with patch.object(ServiceRegistry, "async_services", return_value=services), patch.object( |
99 | 99 | Function, "hass", hass |
100 | 100 | ): |
101 | 101 | words = await Function.service_completions(root) |
@@ -1247,10 +1247,10 @@ def service_call_exception(): |
1247 | 1247 | @pytest.mark.asyncio |
1248 | 1248 | async def test_service_call_params(hass): |
1249 | 1249 | """Test that hass params get set properly on service calls.""" |
1250 | | - with patch.object(hass.services, "async_call") as call, patch.object( |
| 1250 | + with patch.object(ServiceRegistry, "async_call") as call, patch.object( |
1251 | 1251 | Function, "service_has_service", return_value=True |
1252 | 1252 | ), patch.object( |
1253 | | - hass.services, |
| 1253 | + ServiceRegistry, |
1254 | 1254 | "supports_response", |
1255 | 1255 | return_value="none", |
1256 | 1256 | ): |
|
0 commit comments