1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Handle ambiguous script actions by using action map order (#114825)

This commit is contained in:
J. Nick Koston
2024-04-04 20:42:57 -10:00
committed by GitHub
parent 1f37774352
commit bfe944f666
2 changed files with 28 additions and 0 deletions

View File

@@ -1672,3 +1672,25 @@ def test_color_hex() -> None:
with pytest.raises(vol.Invalid, match=msg):
cv.color_hex(123456)
def test_determine_script_action_ambiguous():
"""Test determine script action with ambiguous actions."""
assert (
cv.determine_script_action(
{
"type": "is_power",
"condition": "device",
"device_id": "9c2bda81bc7997c981f811c32cafdb22",
"entity_id": "2ee287ec70dd0c6db187b539bee429b7",
"domain": "sensor",
"below": "15",
}
)
== "condition"
)
def test_determine_script_action_non_ambiguous():
"""Test determine script action with a non ambiguous action."""
assert cv.determine_script_action({"delay": "00:00:05"}) == "delay"