Use service helper to extract bosch alarm config entry (#162789)

This commit is contained in:
epenet
2026-02-12 00:04:50 -05:00
committed by GitHub
parent f9bd1b3d30
commit efa522cc73
3 changed files with 11 additions and 31 deletions
@@ -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"