UniFi - Change handling of updated options (#31762)

* Change handling of updated options

* Add tests
This commit is contained in:
Robert Svensson authored and GitHub committed 2020-02-12 16:15:08 -08:00
1 parent e0a035ce35
commit 4cac0443e2
5 files changed
+320 -98

No files matched your search

+24
View File
@@ -99,3 +99,27 @@ async def test_sensors(hass):
wireless_client_tx = hass.states.get("sensor.wireless_client_name_tx")
assert wireless_client_tx.state == "6789.0"
hass.config_entries.async_update_entry(
controller.config_entry,
options={unifi.const.CONF_ALLOW_BANDWIDTH_SENSORS: False},
)
await hass.async_block_till_done()
wireless_client_rx = hass.states.get("sensor.wireless_client_name_rx")
assert wireless_client_rx is None
wireless_client_tx = hass.states.get("sensor.wireless_client_name_tx")
assert wireless_client_tx is None
hass.config_entries.async_update_entry(
controller.config_entry,
options={unifi.const.CONF_ALLOW_BANDWIDTH_SENSORS: True},
)
await hass.async_block_till_done()
wireless_client_rx = hass.states.get("sensor.wireless_client_name_rx")
assert wireless_client_rx.state == "2345.0"
wireless_client_tx = hass.states.get("sensor.wireless_client_name_tx")
assert wireless_client_tx.state == "6789.0"