mirror of
https://github.com/home-assistant/core.git
synced 2026-10-30 18:21:41 -04:00
Use service helper to extract bosch alarm config entry (#162789)
This commit is contained in:
@@ -59,10 +59,7 @@ async def test_set_date_time_service_fails_bad_entity(
|
||||
) -> None:
|
||||
"""Test that the service calls fail if the service call is done for an incorrect entity."""
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
with pytest.raises(
|
||||
ServiceValidationError,
|
||||
match='Integration "bad-config_id" not found in registry',
|
||||
):
|
||||
with pytest.raises(ServiceValidationError) as err:
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_DATE_TIME,
|
||||
@@ -72,6 +69,8 @@ async def test_set_date_time_service_fails_bad_entity(
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
assert err.value.translation_key == "service_config_entry_not_found"
|
||||
assert err.value.translation_placeholders["entry_id"] == "bad-config_id"
|
||||
|
||||
|
||||
async def test_set_date_time_service_fails_bad_params(
|
||||
@@ -177,10 +176,7 @@ async def test_set_date_time_service_fails_unloaded(
|
||||
"""Test that the service calls fail if the config entry is unloaded."""
|
||||
await async_setup_component(hass, DOMAIN, {})
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
with pytest.raises(
|
||||
HomeAssistantError,
|
||||
match=f"{mock_config_entry.title} is not loaded",
|
||||
):
|
||||
with pytest.raises(ServiceValidationError) as err:
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_DATE_TIME,
|
||||
@@ -190,3 +186,5 @@ async def test_set_date_time_service_fails_unloaded(
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
assert err.value.translation_key == "service_config_entry_not_loaded"
|
||||
assert err.value.translation_placeholders["entry_title"] == "Mock Title"
|
||||
|
||||
Reference in New Issue
Block a user