From 4b674b1d16de47980391338f051dd37e3517f5b8 Mon Sep 17 00:00:00 2001 From: cdce8p <30130371+cdce8p@users.noreply.github.com> Date: Wed, 26 Sep 2018 18:03:13 +0200 Subject: [PATCH] Remove unused legacy test helper methods (#16893) --- tests/components/camera/common.py | 23 +---------------------- tests/components/fan/common.py | 12 +----------- tests/components/test_input_select.py | 12 ------------ 3 files changed, 2 insertions(+), 45 deletions(-) diff --git a/tests/components/camera/common.py b/tests/components/camera/common.py index 71193f1a99d..21f7244bd29 100644 --- a/tests/components/camera/common.py +++ b/tests/components/camera/common.py @@ -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): diff --git a/tests/components/fan/common.py b/tests/components/fan/common.py index d4caf28be5b..60e1cab1ac0 100644 --- a/tests/components/fan/common.py +++ b/tests/components/fan/common.py @@ -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: diff --git a/tests/components/test_input_select.py b/tests/components/test_input_select.py index 938c93fa099..25f6d1c7673 100644 --- a/tests/components/test_input_select.py +++ b/tests/components/test_input_select.py @@ -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."""