Increase test coverage for rfxtrx integration (#39340)

* Increase switch coverage

* Increase binary sensor coverage

* Final improvements

* Remove debug statement

* Adjust test duplicate cover

* Remove None return test

* Assert on length of conf_entries

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
Rob Bierbooms 2020-08-28 22:05:11 +02:00 committed by GitHub
parent b315df2118
commit 5658a1efec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 110 additions and 0 deletions

View file

@ -3,6 +3,7 @@ from unittest.mock import call
import pytest
from homeassistant.components.rfxtrx import DOMAIN
from homeassistant.core import State
from homeassistant.setup import async_setup_component
@ -151,3 +152,24 @@ async def test_discover_rfy_sun_switch(hass, rfxtrx_automatic):
state = hass.states.get("switch.rfy_030101_1")
assert state
assert state.state == "on"
async def test_unknown_event_code(hass, rfxtrx):
"""Test with 3 switches."""
assert await async_setup_component(
hass,
"rfxtrx",
{
"rfxtrx": {
"device": "abcd",
"devices": {"1234567890": {}},
}
},
)
await hass.async_block_till_done()
conf_entries = hass.config_entries.async_entries(DOMAIN)
assert len(conf_entries) == 1
entry = conf_entries[0]
assert entry.state == "loaded"