Make script services always respond when asked (#95991)

* Make script services always respond when asked

* Update test_init.py
This commit is contained in:
Bram Kragten 2023-07-06 16:48:03 +02:00 committed by GitHub
parent 2b0f2227fd
commit 5d9533fb90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -26,7 +26,7 @@ from homeassistant.core import (
callback,
split_entity_id,
)
from homeassistant.exceptions import HomeAssistantError, ServiceNotFound
from homeassistant.exceptions import ServiceNotFound
from homeassistant.helpers import entity_registry as er, template
from homeassistant.helpers.event import async_track_state_change
from homeassistant.helpers.script import (
@ -1625,7 +1625,7 @@ async def test_responses(hass: HomeAssistant, response: Any) -> None:
)
async def test_responses_error(hass: HomeAssistant) -> None:
async def test_responses_no_response(hass: HomeAssistant) -> None:
"""Test response variable not set."""
mock_restore_cache(hass, ())
assert await async_setup_component(
@ -1645,10 +1645,13 @@ async def test_responses_error(hass: HomeAssistant) -> None:
},
)
with pytest.raises(HomeAssistantError):
assert await hass.services.async_call(
# Validate we can call it with return_response
assert (
await hass.services.async_call(
DOMAIN, "test", {"greeting": "world"}, blocking=True, return_response=True
)
== {}
)
# Validate we can also call it without return_response
assert (
await hass.services.async_call(