Add verisure ethernet status (#28656)

This commit is contained in:
Thomas Germain authored and Martin Hjelmare committed 2019-11-13 14:12:36 +01:00
1 parent 8f390d099a
commit ec45e72bea
3 files changed
+109 -4

No files matched your search

+7 -3
View File
@@ -50,6 +50,9 @@ LOCKS = ["door_lock"]
def mock_hub(config, get_response=LOCKS[0]):
"""Extensively mock out a verisure hub."""
hub_prefix = "homeassistant.components.verisure.lock.hub"
# Since there is no conf to disable ethernet status, mock hub for
# binary sensor too
hub_binary_sensor = "homeassistant.components.verisure.binary_sensor.hub"
verisure_prefix = "verisure.Session"
with patch(verisure_prefix) as session, patch(hub_prefix) as hub:
session.login.return_value = True
@@ -62,7 +65,8 @@ def mock_hub(config, get_response=LOCKS[0]):
}
hub.session.get_lock_state_transaction.return_value = {"result": "OK"}
yield hub
with patch(hub_binary_sensor, hub):
yield hub
async def setup_verisure_locks(hass, config):
@@ -70,8 +74,8 @@ async def setup_verisure_locks(hass, config):
with mock_hub(config):
await async_setup_component(hass, VERISURE_DOMAIN, config)
await hass.async_block_till_done()
# lock.door_lock, group.all_locks
assert len(hass.states.async_all()) == 2
# lock.door_lock, group.all_locks, ethernet_status
assert len(hass.states.async_all()) == 3
async def test_verisure_no_default_code(hass):