mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Address Blebox uniapi review sidenotes (#74298)
* Changes accordingly to sidenotes given by @MartinHjelmare in pull #73834. * Mini version bump according to notes in pull #73834. * Error message fix, test adjustment.
This commit is contained in:
@@ -509,17 +509,18 @@ async def test_turn_on_failure(feature, hass, config, caplog):
|
||||
caplog.set_level(logging.ERROR)
|
||||
|
||||
feature_mock, entity_id = feature
|
||||
feature_mock.async_on = AsyncMock(side_effect=blebox_uniapi.error.BadOnValueError)
|
||||
feature_mock.async_on = AsyncMock(side_effect=ValueError)
|
||||
await async_setup_entity(hass, config, entity_id)
|
||||
|
||||
feature_mock.sensible_on_value = 123
|
||||
await hass.services.async_call(
|
||||
"light",
|
||||
SERVICE_TURN_ON,
|
||||
{"entity_id": entity_id},
|
||||
blocking=True,
|
||||
)
|
||||
with pytest.raises(ValueError) as info:
|
||||
await hass.services.async_call(
|
||||
"light",
|
||||
SERVICE_TURN_ON,
|
||||
{"entity_id": entity_id},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
assert (
|
||||
f"Turning on '{feature_mock.full_name}' failed: Bad value 123 ()" in caplog.text
|
||||
assert f"Turning on '{feature_mock.full_name}' failed: Bad value 123" in str(
|
||||
info.value
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user