Add tests for the Plugwise Select platform (#75774)

This commit is contained in:
Bouwe Westerdijk 2022-07-26 22:02:50 +02:00 committed by GitHub
parent 184e254a43
commit aaaca0b2bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 1 deletions

View File

@ -927,7 +927,6 @@ omit =
homeassistant/components/plex/cast.py
homeassistant/components/plex/media_player.py
homeassistant/components/plex/view.py
homeassistant/components/plugwise/select.py
homeassistant/components/plum_lightpad/light.py
homeassistant/components/pocketcasts/sensor.py
homeassistant/components/point/__init__.py

View File

@ -0,0 +1,44 @@
"""Tests for the Plugwise Select integration."""
from unittest.mock import MagicMock
from homeassistant.components.select import (
ATTR_OPTION,
DOMAIN as SELECT_DOMAIN,
SERVICE_SELECT_OPTION,
)
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
async def test_adam_select_entities(
hass: HomeAssistant, mock_smile_adam: MagicMock, init_integration: MockConfigEntry
) -> None:
"""Test a select."""
state = hass.states.get("select.zone_lisa_wk_thermostat_schedule")
assert state
assert state.state == "GF7 Woonkamer"
async def test_adam_change_select_entity(
hass: HomeAssistant, mock_smile_adam: MagicMock, init_integration: MockConfigEntry
) -> None:
"""Test changing of select entities."""
await hass.services.async_call(
SELECT_DOMAIN,
SERVICE_SELECT_OPTION,
{
ATTR_ENTITY_ID: "select.zone_lisa_wk_thermostat_schedule",
ATTR_OPTION: "Badkamer Schema",
},
blocking=True,
)
assert mock_smile_adam.set_schedule_state.call_count == 1
mock_smile_adam.set_schedule_state.assert_called_with(
"c50f167537524366a5af7aa3942feb1e", "Badkamer Schema", "on"
)