Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions tests/components/camera/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,20 @@
components. Instead call the service directly.
"""
from homeassistant.components.camera import (
ATTR_FILENAME, DOMAIN, SERVICE_DISABLE_MOTION, SERVICE_ENABLE_MOTION,
SERVICE_SNAPSHOT)
ATTR_FILENAME, DOMAIN, SERVICE_ENABLE_MOTION, SERVICE_SNAPSHOT)
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, \
SERVICE_TURN_ON
from homeassistant.core import callback
from homeassistant.loader import bind_hass


@bind_hass
def turn_off(hass, entity_id=None):
"""Turn off camera."""
hass.add_job(async_turn_off, hass, entity_id)


@bind_hass
async def async_turn_off(hass, entity_id=None):
"""Turn off camera."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
await hass.services.async_call(DOMAIN, SERVICE_TURN_OFF, data)


@bind_hass
def turn_on(hass, entity_id=None):
"""Turn on camera."""
hass.add_job(async_turn_on, hass, entity_id)


@bind_hass
async def async_turn_on(hass, entity_id=None):
"""Turn on camera, and set operation mode."""
Expand All @@ -49,14 +36,6 @@ def enable_motion_detection(hass, entity_id=None):
DOMAIN, SERVICE_ENABLE_MOTION, data))


@bind_hass
def disable_motion_detection(hass, entity_id=None):
"""Disable Motion Detection."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else None
hass.async_add_job(hass.services.async_call(
DOMAIN, SERVICE_DISABLE_MOTION, data))


@bind_hass
@callback
def async_snapshot(hass, filename, entity_id=None):
Expand Down
12 changes: 1 addition & 11 deletions tests/components/fan/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ATTR_DIRECTION, ATTR_SPEED, ATTR_OSCILLATING, DOMAIN,
SERVICE_OSCILLATE, SERVICE_SET_DIRECTION, SERVICE_SET_SPEED)
from homeassistant.const import (
ATTR_ENTITY_ID, SERVICE_TURN_ON, SERVICE_TOGGLE, SERVICE_TURN_OFF)
ATTR_ENTITY_ID, SERVICE_TURN_ON, SERVICE_TURN_OFF)
from homeassistant.loader import bind_hass


Expand All @@ -32,16 +32,6 @@ def turn_off(hass, entity_id: str = None) -> None:
hass.services.call(DOMAIN, SERVICE_TURN_OFF, data)


@bind_hass
def toggle(hass, entity_id: str = None) -> None:
"""Toggle all or specified fans."""
data = {
ATTR_ENTITY_ID: entity_id
}

hass.services.call(DOMAIN, SERVICE_TOGGLE, data)


@bind_hass
def oscillate(hass, entity_id: str = None,
should_oscillate: bool = True) -> None:
Expand Down
12 changes: 0 additions & 12 deletions tests/components/test_input_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@ def select_previous(hass, entity_id):
})


@bind_hass
def set_options(hass, entity_id, options):
"""Set options of input_select.

This is a legacy helper method. Do not use it for new tests.
"""
hass.services.call(DOMAIN, SERVICE_SET_OPTIONS, {
ATTR_ENTITY_ID: entity_id,
ATTR_OPTIONS: options,
})


class TestInputSelect(unittest.TestCase):
"""Test the input select component."""

Expand Down