Remove deprecated reset_waste_drawer and set_wait_time services from litterrobot (#77052)
This commit is contained in:
parent
7fbb9c189f
commit
8c24d5810c
3 changed files with 3 additions and 101 deletions
|
@ -6,15 +6,10 @@ from typing import Any
|
|||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
from voluptuous.error import MultipleInvalid
|
||||
|
||||
from homeassistant.components.litterrobot import DOMAIN
|
||||
from homeassistant.components.litterrobot.entity import REFRESH_WAIT_TIME_SECONDS
|
||||
from homeassistant.components.litterrobot.vacuum import (
|
||||
SERVICE_RESET_WASTE_DRAWER,
|
||||
SERVICE_SET_SLEEP_MODE,
|
||||
SERVICE_SET_WAIT_TIME,
|
||||
)
|
||||
from homeassistant.components.litterrobot.vacuum import SERVICE_SET_SLEEP_MODE
|
||||
from homeassistant.components.vacuum import (
|
||||
ATTR_STATUS,
|
||||
DOMAIN as PLATFORM_DOMAIN,
|
||||
|
@ -34,16 +29,14 @@ from .conftest import setup_integration
|
|||
from tests.common import async_fire_time_changed
|
||||
|
||||
COMPONENT_SERVICE_DOMAIN = {
|
||||
SERVICE_RESET_WASTE_DRAWER: DOMAIN,
|
||||
SERVICE_SET_SLEEP_MODE: DOMAIN,
|
||||
SERVICE_SET_WAIT_TIME: DOMAIN,
|
||||
}
|
||||
|
||||
|
||||
async def test_vacuum(hass: HomeAssistant, mock_account: MagicMock) -> None:
|
||||
"""Tests the vacuum entity was set up."""
|
||||
await setup_integration(hass, mock_account, PLATFORM_DOMAIN)
|
||||
assert hass.services.has_service(DOMAIN, SERVICE_RESET_WASTE_DRAWER)
|
||||
assert hass.services.has_service(DOMAIN, SERVICE_SET_SLEEP_MODE)
|
||||
|
||||
vacuum = hass.states.get(VACUUM_ENTITY_ID)
|
||||
assert vacuum
|
||||
|
@ -68,7 +61,7 @@ async def test_no_robots(
|
|||
"""Tests the vacuum entity was set up."""
|
||||
await setup_integration(hass, mock_account_with_no_robots, PLATFORM_DOMAIN)
|
||||
|
||||
assert not hass.services.has_service(DOMAIN, SERVICE_RESET_WASTE_DRAWER)
|
||||
assert not hass.services.has_service(DOMAIN, SERVICE_SET_SLEEP_MODE)
|
||||
|
||||
|
||||
async def test_vacuum_with_error(
|
||||
|
@ -88,7 +81,6 @@ async def test_vacuum_with_error(
|
|||
(SERVICE_START, "start_cleaning", None),
|
||||
(SERVICE_TURN_OFF, "set_power_status", None),
|
||||
(SERVICE_TURN_ON, "set_power_status", None),
|
||||
(SERVICE_RESET_WASTE_DRAWER, "reset_waste_drawer", {"deprecated": True}),
|
||||
(
|
||||
SERVICE_SET_SLEEP_MODE,
|
||||
"set_sleep_mode",
|
||||
|
@ -96,16 +88,6 @@ async def test_vacuum_with_error(
|
|||
),
|
||||
(SERVICE_SET_SLEEP_MODE, "set_sleep_mode", {"data": {"enabled": True}}),
|
||||
(SERVICE_SET_SLEEP_MODE, "set_sleep_mode", {"data": {"enabled": False}}),
|
||||
(
|
||||
SERVICE_SET_WAIT_TIME,
|
||||
"set_wait_time",
|
||||
{"data": {"minutes": 3}, "deprecated": True},
|
||||
),
|
||||
(
|
||||
SERVICE_SET_WAIT_TIME,
|
||||
"set_wait_time",
|
||||
{"data": {"minutes": "15"}, "deprecated": True},
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_commands(
|
||||
|
@ -137,21 +119,3 @@ async def test_commands(
|
|||
async_fire_time_changed(hass, future)
|
||||
getattr(mock_account.robots[0], command).assert_called_once()
|
||||
assert (f"'{DOMAIN}.{service}' service is deprecated" in caplog.text) is deprecated
|
||||
|
||||
|
||||
async def test_invalid_wait_time(hass: HomeAssistant, mock_account: MagicMock) -> None:
|
||||
"""Test an attempt to send an invalid wait time to the vacuum."""
|
||||
await setup_integration(hass, mock_account, PLATFORM_DOMAIN)
|
||||
|
||||
vacuum = hass.states.get(VACUUM_ENTITY_ID)
|
||||
assert vacuum
|
||||
assert vacuum.state == STATE_DOCKED
|
||||
|
||||
with pytest.raises(MultipleInvalid):
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_WAIT_TIME,
|
||||
{ATTR_ENTITY_ID: VACUUM_ENTITY_ID, "minutes": 10},
|
||||
blocking=True,
|
||||
)
|
||||
assert not mock_account.robots[0].set_wait_time.called
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue