Remove unused legacy test helper methods (#16893)
This commit is contained in:
parent
dd45e99302
commit
4b674b1d16
3 changed files with 2 additions and 45 deletions
|
@ -4,20 +4,13 @@ All containing methods are legacy helpers that should not be used by new
|
|||
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."""
|
||||
|
@ -25,12 +18,6 @@ async def async_turn_off(hass, entity_id=None):
|
|||
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."""
|
||||
|
@ -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):
|
||||
|
|
|
@ -7,7 +7,7 @@ from homeassistant.components.fan import (
|
|||
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
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
|
|
@ -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."""
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue