Update trigger validation message (#126749)

This commit is contained in:
Joost Lekkerkerker 2024-09-25 15:33:03 +02:00 committed by GitHub
parent 662a704165
commit 33d83e43de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -225,7 +225,7 @@ async def _async_get_trigger_platform(
try: try:
integration = await async_get_integration(hass, platform) integration = await async_get_integration(hass, platform)
except IntegrationNotFound: except IntegrationNotFound:
raise vol.Invalid(f"Invalid platform '{platform}' specified") from None raise vol.Invalid(f"Invalid trigger '{platform}' specified") from None
try: try:
return await integration.async_get_platform("trigger") return await integration.async_get_platform("trigger")
except ImportError: except ImportError:

View File

@ -2601,7 +2601,7 @@ async def test_validate_config_works(
( (
"triggers", "triggers",
{"platform": "non_existing", "event_type": "hello"}, {"platform": "non_existing", "event_type": "hello"},
"Invalid platform 'non_existing' specified", "Invalid trigger 'non_existing' specified",
), ),
# Raises vol.Invalid # Raises vol.Invalid
( (

View File

@ -20,7 +20,7 @@ async def test_bad_trigger_platform(hass: HomeAssistant) -> None:
"""Test bad trigger platform.""" """Test bad trigger platform."""
with pytest.raises(vol.Invalid) as ex: with pytest.raises(vol.Invalid) as ex:
await async_validate_trigger_config(hass, [{"platform": "not_a_platform"}]) await async_validate_trigger_config(hass, [{"platform": "not_a_platform"}])
assert "Invalid platform 'not_a_platform' specified" in str(ex) assert "Invalid trigger 'not_a_platform' specified" in str(ex)
async def test_trigger_subtype(hass: HomeAssistant) -> None: async def test_trigger_subtype(hass: HomeAssistant) -> None: