Fix Insteon tests (#71092)

This commit is contained in:
Tom Harris 2022-04-30 00:26:27 -04:00 committed by GitHub
parent 69fa7b0d61
commit 781ec87dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View File

@ -3,7 +3,7 @@
"program_lock_on": false, "program_lock_on": false,
"blink_on_tx_on": false, "blink_on_tx_on": false,
"resume_dim_on": false, "resume_dim_on": false,
"led_on": false, "led_off": false,
"key_beep_on": false, "key_beep_on": false,
"rf_disable_on": false, "rf_disable_on": false,
"powerline_disable_on": false, "powerline_disable_on": false,

View File

@ -1,7 +1,7 @@
"""Mock devices object to test Insteon.""" """Mock devices object to test Insteon."""
import asyncio import asyncio
from unittest.mock import AsyncMock, MagicMock from unittest.mock import AsyncMock, MagicMock, patch
from pyinsteon.address import Address from pyinsteon.address import Address
from pyinsteon.constants import ALDBStatus, ResponseStatus from pyinsteon.constants import ALDBStatus, ResponseStatus
@ -129,10 +129,12 @@ class MockDevices:
def fill_properties(self, address, props_dict): def fill_properties(self, address, props_dict):
"""Fill the operating flags and extended properties of a device.""" """Fill the operating flags and extended properties of a device."""
device = self._devices[Address(address)] device = self._devices[Address(address)]
operating_flags = props_dict.get("operating_flags", {}) operating_flags = props_dict.get("operating_flags", {})
properties = props_dict.get("properties", {}) properties = props_dict.get("properties", {})
with patch("pyinsteon.subscriber_base.publish_topic", MagicMock()):
for flag in operating_flags: for flag in operating_flags:
value = operating_flags[flag] value = operating_flags[flag]
if device.operating_flags.get(flag): if device.operating_flags.get(flag):