1
0
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:
Michał Huryn
2022-07-03 17:06:38 +02:00
committed by GitHub
parent a4c6cd2fbe
commit e7e940afa5
8 changed files with 37 additions and 42 deletions

View File

@@ -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
)