Skip to content

Commit

Permalink
tested update_switch CannontConnect exception
Browse files Browse the repository at this point in the history
  • Loading branch information
sekyHC committed Oct 7, 2022
1 parent 0b2b1f8 commit c4c82b4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/components/konnected/test_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest

from homeassistant.components.konnected import config_flow, panel
from homeassistant.components.konnected.errors import CannotConnect
from homeassistant.helpers.entity_component import async_update_entity
from homeassistant.setup import async_setup_component
from homeassistant.util import utcnow
Expand Down Expand Up @@ -152,6 +153,11 @@ async def test_create_and_setup(hass, mock_panel):
"endpoint": "http://192.168.1.1:8123/api/konnected",
}

mock_panel.put_zone.side_effect = mock_panel.ClientError
mock_panel.put_device.side_effect = mock_panel.ClientError
with pytest.raises(CannotConnect):
await device.update_switch("1", 0)

# confirm the device settings are saved in hass.data
assert device.stored_configuration == {
"binary_sensors": {
Expand Down

0 comments on commit c4c82b4

Please sign in to comment.