Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
joostlek committed Sep 25, 2024
1 parent a033ef0 commit e87e545
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion homeassistant/helpers/config_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ def _trigger_pre_validator(value: Any | None) -> Any:
value = dict(value)
value[CONF_PLATFORM] = value.pop(CONF_TRIGGER)
elif CONF_PLATFORM not in value:
raise vol.Invalid("Missing 'trigger' key in trigger.")
raise vol.Invalid("required key not provided", ["trigger"])

return value

Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/test_config_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,7 @@ async def test_trigger_backwards_compatibility() -> None:
cv._trigger_pre_validator({"trigger": "abc", "platform": "def"})
with pytest.raises(

Check failure on line 1922 in tests/helpers/test_config_validation.py

View workflow job for this annotation

GitHub Actions / Run tests Python 3.12 (3)

test_trigger_backwards_compatibility AssertionError: Regex pattern did not match. Regex: "required key not provided @ data['trigger']" Input: "required key not provided @ data['trigger']" Did you mean to `re.escape()` the regex?
vol.Invalid,
match="Missing 'trigger' key in trigger.",
match="required key not provided @ data['trigger']",
):
cv._trigger_pre_validator({})

Expand Down

0 comments on commit e87e545

Please sign in to comment.