mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 02:37:50 +00:00
Fetch ServiceNotFound message from translation cache (#113893)
This commit is contained in:
parent
8edbf88da1
commit
dc38d152df
@ -261,7 +261,6 @@ class ServiceNotFound(HomeAssistantError):
|
|||||||
"""Initialize error."""
|
"""Initialize error."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
self,
|
self,
|
||||||
f"Service {domain}.{service} not found.",
|
|
||||||
translation_domain="homeassistant",
|
translation_domain="homeassistant",
|
||||||
translation_key="service_not_found",
|
translation_key="service_not_found",
|
||||||
translation_placeholders={"domain": domain, "service": service},
|
translation_placeholders={"domain": domain, "service": service},
|
||||||
|
@ -1676,8 +1676,18 @@ async def test_serviceregistry_service_that_not_exists(hass: HomeAssistant) -> N
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(calls_remove) == 0
|
assert len(calls_remove) == 0
|
||||||
|
|
||||||
with pytest.raises(ServiceNotFound):
|
with pytest.raises(ServiceNotFound) as exc:
|
||||||
await hass.services.async_call("test_do_not", "exist", {})
|
await hass.services.async_call("test_do_not", "exist", {})
|
||||||
|
assert exc.value.translation_domain == "homeassistant"
|
||||||
|
assert exc.value.translation_key == "service_not_found"
|
||||||
|
assert exc.value.translation_placeholders == {
|
||||||
|
"domain": "test_do_not",
|
||||||
|
"service": "exist",
|
||||||
|
}
|
||||||
|
assert exc.value.domain == "test_do_not"
|
||||||
|
assert exc.value.service == "exist"
|
||||||
|
|
||||||
|
assert str(exc.value) == "Service test_do_not.exist not found."
|
||||||
|
|
||||||
|
|
||||||
async def test_serviceregistry_async_service_raise_exception(
|
async def test_serviceregistry_async_service_raise_exception(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user