Get ServiceValidationError message from translation cache only (#113704)

* Get ServiceValidationError message from translation cache only

* Remove message for NotValidPresetModeError
This commit is contained in:
Jan Bouwhuis
2024-03-18 14:42:21 +01:00
committed by GitHub
parent ec7aecef84
commit 3dc8df2403
18 changed files with 16 additions and 43 deletions

View File

@@ -348,12 +348,12 @@ async def test_add_item_service_raises(
(
{"item": "Submit forms", "description": "Submit tax forms"},
ServiceValidationError,
"does not support setting field 'description'",
"does not support setting field: description",
),
(
{"item": "Submit forms", "due_date": "2023-11-17"},
ServiceValidationError,
"does not support setting field 'due_date'",
"does not support setting field: due_date",
),
(
{
@@ -361,7 +361,7 @@ async def test_add_item_service_raises(
"due_datetime": f"2023-11-17T17:00:00{TEST_OFFSET}",
},
ServiceValidationError,
"does not support setting field 'due_datetime'",
"does not support setting field: due_datetime",
),
],
)
@@ -376,7 +376,7 @@ async def test_add_item_service_invalid_input(
await create_mock_platform(hass, [test_entity])
with pytest.raises(expected_exception, match=expected_error):
with pytest.raises(expected_exception) as exc:
await hass.services.async_call(
DOMAIN,
"add_item",
@@ -385,6 +385,8 @@ async def test_add_item_service_invalid_input(
blocking=True,
)
assert expected_error in str(exc.value)
@pytest.mark.parametrize(
("supported_entity_feature", "item_data", "expected_item"),