mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add button support to Google Assistant (#60158)
This commit is contained in:
@@ -7,6 +7,7 @@ import pytest
|
||||
from homeassistant.components import (
|
||||
alarm_control_panel,
|
||||
binary_sensor,
|
||||
button,
|
||||
camera,
|
||||
cover,
|
||||
fan,
|
||||
@@ -767,6 +768,26 @@ async def test_light_modes(hass):
|
||||
}
|
||||
|
||||
|
||||
async def test_scene_button(hass):
|
||||
"""Test Scene trait support for the button domain."""
|
||||
assert helpers.get_google_type(button.DOMAIN, None) is not None
|
||||
assert trait.SceneTrait.supported(button.DOMAIN, 0, None, None)
|
||||
|
||||
trt = trait.SceneTrait(hass, State("button.bla", STATE_UNKNOWN), BASIC_CONFIG)
|
||||
assert trt.sync_attributes() == {}
|
||||
assert trt.query_attributes() == {}
|
||||
assert trt.can_execute(trait.COMMAND_ACTIVATE_SCENE, {})
|
||||
|
||||
calls = async_mock_service(hass, button.DOMAIN, button.SERVICE_PRESS)
|
||||
await trt.execute(trait.COMMAND_ACTIVATE_SCENE, BASIC_DATA, {}, {})
|
||||
|
||||
# We don't wait till button press is done.
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(calls) == 1
|
||||
assert calls[0].data == {ATTR_ENTITY_ID: "button.bla"}
|
||||
|
||||
|
||||
async def test_scene_scene(hass):
|
||||
"""Test Scene trait support for scene domain."""
|
||||
assert helpers.get_google_type(scene.DOMAIN, None) is not None
|
||||
|
||||
Reference in New Issue
Block a user