Increase test coverage for rfxtrx integration (#38435)

* Remove rfxtrx from coveragerc

* Tweak binary sensor test

* Tweak light test
This commit is contained in:
Rob Bierbooms 2020-08-01 18:26:26 +02:00 committed by GitHub
parent 11994d207a
commit af97141f4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 1 deletions

View File

@ -692,7 +692,6 @@ omit =
homeassistant/components/rest/binary_sensor.py
homeassistant/components/rest/notify.py
homeassistant/components/rest/switch.py
homeassistant/components/rfxtrx/*
homeassistant/components/ring/camera.py
homeassistant/components/ripple/sensor.py
homeassistant/components/rocketchat/notify.py

View File

@ -204,6 +204,24 @@ async def test_off_delay(hass, rfxtrx, timestep):
assert state
assert state.state == "off"
await rfxtrx.signal("0b1100100118cdea02010f70")
state = hass.states.get("binary_sensor.ac_118cdea_2")
assert state
assert state.state == "on"
await timestep(3)
await rfxtrx.signal("0b1100100118cdea02010f70")
await timestep(4)
state = hass.states.get("binary_sensor.ac_118cdea_2")
assert state
assert state.state == "on"
await timestep(4)
state = hass.states.get("binary_sensor.ac_118cdea_2")
assert state
assert state.state == "off"
async def test_panic(hass, rfxtrx_automatic):
"""Test panic entities."""

View File

@ -123,6 +123,7 @@ async def test_several_lights(hass, rfxtrx):
},
)
await hass.async_block_till_done()
await hass.async_start()
state = hass.states.get("light.ac_213c7f2_48")
assert state
@ -139,6 +140,22 @@ async def test_several_lights(hass, rfxtrx):
assert state.state == "off"
assert state.attributes.get("friendly_name") == "AC 1118cdea:2"
await rfxtrx.signal("0b1100cd0213c7f230010f71")
state = hass.states.get("light.ac_213c7f2_48")
assert state
assert state.state == "on"
await rfxtrx.signal("0b1100cd0213c7f230000f71")
state = hass.states.get("light.ac_213c7f2_48")
assert state
assert state.state == "off"
await rfxtrx.signal("0b1100cd0213c7f230020f71")
state = hass.states.get("light.ac_213c7f2_48")
assert state
assert state.state == "on"
assert state.attributes.get("brightness") == 255
@pytest.mark.parametrize("repetitions", [1, 3])
async def test_repetitions(hass, rfxtrx, repetitions):