Fix intent helper test (#118053)

Fix test
pull/118056/head
Michael Hansen 2024-05-24 11:59:19 -05:00 committed by GitHub
parent 6a10e89f6d
commit 77e385db52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -708,6 +708,9 @@ async def test_invalid_area_floor_names(hass: HomeAssistant) -> None:
)
intent.async_register(hass, handler)
# Need a light to avoid domain error
hass.states.async_set("light.test", "off")
with pytest.raises(intent.MatchFailedError) as err:
await intent.async_handle(
hass,
@ -715,7 +718,7 @@ async def test_invalid_area_floor_names(hass: HomeAssistant) -> None:
"TestType",
slots={"area": {"value": "invalid area"}},
)
assert err.value.result.no_match_reason == intent.MatchFailedReason.INVALID_AREA
assert err.value.result.no_match_reason == intent.MatchFailedReason.INVALID_AREA
with pytest.raises(intent.MatchFailedError) as err:
await intent.async_handle(
@ -724,9 +727,7 @@ async def test_invalid_area_floor_names(hass: HomeAssistant) -> None:
"TestType",
slots={"floor": {"value": "invalid floor"}},
)
assert (
err.value.result.no_match_reason == intent.MatchFailedReason.INVALID_FLOOR
)
assert err.value.result.no_match_reason == intent.MatchFailedReason.INVALID_FLOOR
async def test_service_intent_handler_required_domains(hass: HomeAssistant) -> None: