Remove service helper (2) (#16863)

* alarm_control_panel

* automation

* camera

* climate

* counter

* fan

* Add legacy notes

* Fix tests
This commit is contained in:
cdce8p authored and Paulus Schoutsen committed 2018-09-26 09:49:55 +02:00
1 parent c899875abb
commit fa98a27df7
33 files changed
+766 -666

No files matched your search

+7 -5
View File
@@ -8,6 +8,8 @@ from homeassistant.components.camera import STATE_STREAMING, STATE_IDLE
from homeassistant.exceptions import HomeAssistantError
from homeassistant.setup import async_setup_component
from tests.components.camera import common
@pytest.fixture
def demo_camera(hass):
@@ -37,12 +39,12 @@ async def test_init_state_is_streaming(hass, demo_camera):
async def test_turn_on_state_back_to_streaming(hass, demo_camera):
"""After turn on state back to streaming."""
assert demo_camera.state == STATE_STREAMING
await camera.async_turn_off(hass, demo_camera.entity_id)
await common.async_turn_off(hass, demo_camera.entity_id)
await hass.async_block_till_done()
assert demo_camera.state == STATE_IDLE
await camera.async_turn_on(hass, demo_camera.entity_id)
await common.async_turn_on(hass, demo_camera.entity_id)
await hass.async_block_till_done()
assert demo_camera.state == STATE_STREAMING
@@ -50,7 +52,7 @@ async def test_turn_on_state_back_to_streaming(hass, demo_camera):
async def test_turn_off_image(hass, demo_camera):
"""After turn off, Demo camera raise error."""
await camera.async_turn_off(hass, demo_camera.entity_id)
await common.async_turn_off(hass, demo_camera.entity_id)
await hass.async_block_till_done()
with pytest.raises(HomeAssistantError) as error:
@@ -61,7 +63,7 @@ async def test_turn_off_image(hass, demo_camera):
async def test_turn_off_invalid_camera(hass, demo_camera):
"""Turn off non-exist camera should quietly fail."""
assert demo_camera.state == STATE_STREAMING
await camera.async_turn_off(hass, 'camera.invalid_camera')
await common.async_turn_off(hass, 'camera.invalid_camera')
await hass.async_block_till_done()
assert demo_camera.state == STATE_STREAMING
@@ -81,7 +83,7 @@ async def test_motion_detection(hass):
assert not state.attributes.get('motion_detection')
# Call service to turn on motion detection
camera.enable_motion_detection(hass, 'camera.demo_camera')
common.enable_motion_detection(hass, 'camera.demo_camera')
await hass.async_block_till_done()
# Check if state has been updated.