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

Assist fixes (#109889)

* Don't pass entity ids in hassil slot lists

* Use first completed response

* Add more tests
This commit is contained in:
Michael Hansen
2024-02-07 15:13:42 -06:00
committed by GitHub
parent b276a7863b
commit 1750f54da4
9 changed files with 354 additions and 49 deletions

View File

@@ -1,4 +1,5 @@
"""Tests for Intent component."""
import pytest
from homeassistant.components.cover import SERVICE_OPEN_COVER
@@ -225,6 +226,30 @@ async def test_turn_on_multiple_intent(hass: HomeAssistant) -> None:
assert call.data == {"entity_id": ["light.test_lights_2"]}
async def test_turn_on_all(hass: HomeAssistant) -> None:
"""Test HassTurnOn intent with "all" name."""
result = await async_setup_component(hass, "homeassistant", {})
result = await async_setup_component(hass, "intent", {})
assert result
hass.states.async_set("light.test_light", "off")
hass.states.async_set("light.test_light_2", "off")
calls = async_mock_service(hass, "light", SERVICE_TURN_ON)
await intent.async_handle(hass, "test", "HassTurnOn", {"name": {"value": "all"}})
await hass.async_block_till_done()
# All lights should be on now
assert len(calls) == 2
entity_ids = set()
for call in calls:
assert call.domain == "light"
assert call.service == "turn_on"
entity_ids.update(call.data.get("entity_id", []))
assert entity_ids == {"light.test_light", "light.test_light_2"}
async def test_get_state_intent(
hass: HomeAssistant,
area_registry: ar.AreaRegistry,