2019-12-08 23:19:38 +00:00
|
|
|
"""Vera tests."""
|
2020-04-03 07:49:50 +00:00
|
|
|
import pyvera as pv
|
2019-12-08 23:19:38 +00:00
|
|
|
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
2020-04-03 07:49:50 +00:00
|
|
|
from .common import ComponentFactory, new_simple_controller_config
|
2019-12-08 23:19:38 +00:00
|
|
|
|
2020-05-03 18:27:19 +00:00
|
|
|
from tests.async_mock import MagicMock
|
|
|
|
|
2019-12-08 23:19:38 +00:00
|
|
|
|
|
|
|
async def test_scene(
|
|
|
|
hass: HomeAssistant, vera_component_factory: ComponentFactory
|
|
|
|
) -> None:
|
|
|
|
"""Test function."""
|
2020-04-03 07:49:50 +00:00
|
|
|
vera_scene = MagicMock(spec=pv.VeraScene) # type: pv.VeraScene
|
2019-12-08 23:19:38 +00:00
|
|
|
vera_scene.scene_id = 1
|
2020-09-15 03:06:52 +00:00
|
|
|
vera_scene.vera_scene_id = vera_scene.scene_id
|
2019-12-08 23:19:38 +00:00
|
|
|
vera_scene.name = "dev1"
|
|
|
|
entity_id = "scene.dev1_1"
|
|
|
|
|
|
|
|
await vera_component_factory.configure_component(
|
2020-08-27 11:56:20 +00:00
|
|
|
hass=hass,
|
|
|
|
controller_config=new_simple_controller_config(scenes=(vera_scene,)),
|
2019-12-08 23:19:38 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
await hass.services.async_call(
|
2020-08-27 11:56:20 +00:00
|
|
|
"scene",
|
|
|
|
"turn_on",
|
|
|
|
{"entity_id": entity_id},
|
2019-12-08 23:19:38 +00:00
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|