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-14 21:29:35 -07:00
committed by Paulus Schoutsen
parent 533ae85a49
commit a5693c083f
8 changed files with 37 additions and 42 deletions
+10 -9
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
)