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

@ -156,6 +156,8 @@ async def async_setup(hass, config):
# Read device_id from the event code add to the data that will end up in the ConfigEntry
for event_code, event_config in data[CONF_DEVICES].items():
event = get_rfx_object(event_code)
if event is None:
continue
device_id = get_device_id(
event.device, data_bits=event_config.get(CONF_DATA_BITS)
)
@ -229,6 +231,8 @@ def _get_device_lookup(devices):
lookup = dict()
for event_code, event_config in devices.items():
event = get_rfx_object(event_code)
if event is None:
continue
device_id = get_device_id(
event.device, data_bits=event_config.get(CONF_DATA_BITS)
)