Add tests for vera component (#28340)

* Adding tests for vera component.
Fixing update bug in the vera climate platform.

* Updating requrements file.

* Moving vera stop to a job.
Sorting imports.

* Addressing simple PR feedback.

* Splitting tests into platforms.

* Mocking controller instead of using requests_mock.

* Updating pyvera to use version that stops threads quickly.

* Updating requirements files.

* Mocking the pyvera module, not the API.

* Addressing PR feedback.
Handling start/stop of patch in fixture.
Removing unecessary code.

* Using generator
This commit is contained in:
Robert Van Gorkom authored and Martin Hjelmare committed 2019-12-09 00:19:38 +01:00
1 parent 076e0273a2
commit e577f047f7
17 files changed
+831 -3

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
"""Vera tests."""
from unittest.mock import MagicMock
from pyvera import VeraScene
from homeassistant.core import HomeAssistant
from .common import ComponentFactory
async def test_scene(
hass: HomeAssistant, vera_component_factory: ComponentFactory
) -> None:
"""Test function."""
vera_scene = MagicMock(spec=VeraScene) # type: VeraScene
vera_scene.scene_id = 1
vera_scene.name = "dev1"
entity_id = "scene.dev1_1"
await vera_component_factory.configure_component(
hass=hass, scenes=(vera_scene,),
)
await hass.services.async_call(
"scene", "turn_on", {"entity_id": entity_id},
)
await hass.async_block_till_done()