* Use set not list * Events are not entities * Don't await unload_events * Remove checks of entities content in tests * List to set comprehension * Why is it so hard to remember that sets arent parenthesis...
This commit is contained in:
1 parent
8895752837
commit
66a8edb11e
12 files changed
+20
-67
No files matched your search
@@ -2,7 +2,6 @@
|
||||
from copy import deepcopy
|
||||
|
||||
from homeassistant.components import deconz
|
||||
from homeassistant.components.deconz.deconz_event import EVENT
|
||||
import homeassistant.components.sensor as sensor
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_BATTERY,
|
||||
@@ -97,7 +96,6 @@ async def test_no_sensors(hass):
|
||||
gateway = await setup_deconz_integration(hass)
|
||||
assert len(gateway.deconz_ids) == 0
|
||||
assert len(hass.states.async_all()) == 0
|
||||
assert len(gateway.entities[sensor.DOMAIN]) == 0
|
||||
|
||||
|
||||
async def test_sensors(hass):
|
||||
@@ -116,7 +114,6 @@ async def test_sensors(hass):
|
||||
assert "sensor.consumption_sensor" in gateway.deconz_ids
|
||||
assert "sensor.clip_light_level_sensor" not in gateway.deconz_ids
|
||||
assert len(hass.states.async_all()) == 5
|
||||
assert len(gateway.entities[sensor.DOMAIN]) == 5
|
||||
|
||||
light_level_sensor = hass.states.get("sensor.light_level_sensor")
|
||||
assert light_level_sensor.state == "999.8"
|
||||
@@ -177,8 +174,6 @@ async def test_sensors(hass):
|
||||
await gateway.async_reset()
|
||||
|
||||
assert len(hass.states.async_all()) == 0
|
||||
# Daylight sensor from deCONZ is added to set but is disabled by default
|
||||
assert len(gateway.entities[sensor.DOMAIN]) == 1
|
||||
|
||||
|
||||
async def test_allow_clip_sensors(hass):
|
||||
@@ -201,7 +196,6 @@ async def test_allow_clip_sensors(hass):
|
||||
assert "sensor.consumption_sensor" in gateway.deconz_ids
|
||||
assert "sensor.clip_light_level_sensor" in gateway.deconz_ids
|
||||
assert len(hass.states.async_all()) == 6
|
||||
assert len(gateway.entities[sensor.DOMAIN]) == 6
|
||||
|
||||
light_level_sensor = hass.states.get("sensor.light_level_sensor")
|
||||
assert light_level_sensor.state == "999.8"
|
||||
@@ -249,7 +243,6 @@ async def test_allow_clip_sensors(hass):
|
||||
assert "sensor.consumption_sensor" in gateway.deconz_ids
|
||||
assert "sensor.clip_light_level_sensor" not in gateway.deconz_ids
|
||||
assert len(hass.states.async_all()) == 5
|
||||
assert len(gateway.entities[sensor.DOMAIN]) == 5
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
gateway.config_entry, options={deconz.gateway.CONF_ALLOW_CLIP_SENSOR: True}
|
||||
@@ -267,7 +260,6 @@ async def test_allow_clip_sensors(hass):
|
||||
assert "sensor.consumption_sensor" in gateway.deconz_ids
|
||||
assert "sensor.clip_light_level_sensor" in gateway.deconz_ids
|
||||
assert len(hass.states.async_all()) == 6
|
||||
assert len(gateway.entities[sensor.DOMAIN]) == 6
|
||||
|
||||
|
||||
async def test_add_new_sensor(hass):
|
||||
@@ -300,8 +292,6 @@ async def test_add_battery_later(hass):
|
||||
assert len(gateway.deconz_ids) == 0
|
||||
assert len(gateway.events) == 1
|
||||
assert len(remote._callbacks) == 2
|
||||
assert len(gateway.entities[sensor.DOMAIN]) == 0
|
||||
assert len(gateway.entities[EVENT]) == 1
|
||||
|
||||
remote.update({"config": {"battery": 50}})
|
||||
await hass.async_block_till_done()
|
||||
@@ -312,5 +302,3 @@ async def test_add_battery_later(hass):
|
||||
|
||||
battery_sensor = hass.states.get("sensor.switch_1_battery_level")
|
||||
assert battery_sensor is not None
|
||||
assert len(gateway.entities[sensor.DOMAIN]) == 1
|
||||
assert len(gateway.entities[EVENT]) == 1
|
||||
Reference in new issue
Block a user