mirror of
https://github.com/home-assistant/core.git
synced 2025-11-15 22:10:09 +00:00
Add globe light settings for Litter-Robot 4 (#152190)
This commit is contained in:
@@ -19,7 +19,6 @@ from homeassistant.helpers import entity_registry as er
|
||||
from .conftest import setup_integration
|
||||
|
||||
SELECT_ENTITY_ID = "select.test_clean_cycle_wait_time_minutes"
|
||||
PANEL_BRIGHTNESS_ENTITY_ID = "select.test_panel_brightness"
|
||||
|
||||
|
||||
async def test_wait_time_select(
|
||||
@@ -69,26 +68,38 @@ async def test_invalid_wait_time_select(hass: HomeAssistant, mock_account) -> No
|
||||
assert not mock_account.robots[0].set_wait_time.called
|
||||
|
||||
|
||||
async def test_panel_brightness_select(
|
||||
@pytest.mark.parametrize(
|
||||
("entity_id", "initial_value", "robot_command"),
|
||||
[
|
||||
("select.test_globe_brightness", "medium", "set_night_light_brightness"),
|
||||
("select.test_globe_light", "off", "set_night_light_mode"),
|
||||
("select.test_panel_brightness", "medium", "set_panel_brightness"),
|
||||
],
|
||||
)
|
||||
async def test_litterrobot_4_select(
|
||||
hass: HomeAssistant,
|
||||
mock_account_with_litterrobot_4: MagicMock,
|
||||
entity_registry: er.EntityRegistry,
|
||||
entity_id: str,
|
||||
initial_value: str,
|
||||
robot_command: str,
|
||||
) -> None:
|
||||
"""Tests the wait time select entity."""
|
||||
"""Tests a Litter-Robot 4 select entity."""
|
||||
await setup_integration(hass, mock_account_with_litterrobot_4, SELECT_DOMAIN)
|
||||
|
||||
select = hass.states.get(PANEL_BRIGHTNESS_ENTITY_ID)
|
||||
select = hass.states.get(entity_id)
|
||||
assert select
|
||||
assert len(select.attributes[ATTR_OPTIONS]) == 3
|
||||
assert select.state == initial_value
|
||||
|
||||
entity_entry = entity_registry.async_get(PANEL_BRIGHTNESS_ENTITY_ID)
|
||||
entity_entry = entity_registry.async_get(entity_id)
|
||||
assert entity_entry
|
||||
assert entity_entry.entity_category is EntityCategory.CONFIG
|
||||
|
||||
data = {ATTR_ENTITY_ID: PANEL_BRIGHTNESS_ENTITY_ID}
|
||||
data = {ATTR_ENTITY_ID: entity_id}
|
||||
|
||||
robot: LitterRobot4 = mock_account_with_litterrobot_4.robots[0]
|
||||
robot.set_panel_brightness = AsyncMock(return_value=True)
|
||||
setattr(robot, robot_command, AsyncMock(return_value=True))
|
||||
|
||||
for count, option in enumerate(select.attributes[ATTR_OPTIONS]):
|
||||
data[ATTR_OPTION] = option
|
||||
@@ -100,4 +111,4 @@ async def test_panel_brightness_select(
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
assert robot.set_panel_brightness.call_count == count + 1
|
||||
assert getattr(robot, robot_command).call_count == count + 1
|
||||
|
||||
Reference in New Issue
Block a user