mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Raise ServiceValidationError on invalid select option (#106350)
* Raise ServiceValidationError on invalid select option * Fix tests * Correct place holders * More test fixes
This commit is contained in:
@@ -14,6 +14,7 @@ from homeassistant.components.flux_led.const import CONF_WHITE_CHANNEL_TYPE, DOM
|
||||
from homeassistant.components.select import DOMAIN as SELECT_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_OPTION, CONF_HOST, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ServiceValidationError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
@@ -133,7 +134,7 @@ async def test_select_addressable_strip_config(hass: HomeAssistant) -> None:
|
||||
state = hass.states.get(ic_type_entity_id)
|
||||
assert state.state == "WS2812B"
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(ServiceValidationError):
|
||||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
"select_option",
|
||||
@@ -149,7 +150,7 @@ async def test_select_addressable_strip_config(hass: HomeAssistant) -> None:
|
||||
bulb.async_set_device_config.assert_called_once_with(wiring="GRBW")
|
||||
bulb.async_set_device_config.reset_mock()
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(ServiceValidationError):
|
||||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
"select_option",
|
||||
@@ -191,7 +192,7 @@ async def test_select_mutable_0x25_strip_config(hass: HomeAssistant) -> None:
|
||||
state = hass.states.get(operating_mode_entity_id)
|
||||
assert state.state == "RGBWW"
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(ServiceValidationError):
|
||||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
"select_option",
|
||||
@@ -226,7 +227,7 @@ async def test_select_24ghz_remote_config(hass: HomeAssistant) -> None:
|
||||
state = hass.states.get(remote_config_entity_id)
|
||||
assert state.state == "Open"
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(ServiceValidationError):
|
||||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
"select_option",
|
||||
@@ -275,7 +276,7 @@ async def test_select_white_channel_type(hass: HomeAssistant) -> None:
|
||||
state = hass.states.get(operating_mode_entity_id)
|
||||
assert state.state == WhiteChannelType.WARM.name.title()
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(ServiceValidationError):
|
||||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
"select_option",
|
||||
|
||||
Reference in New Issue
Block a user