Removed uncaught exceptions from Dyson (#34112)
* fixed what seems to be a typo * added load_mock_device in common.py so it loads all the required things into the mocks so they don't throw exceptions for mocks not being able to convert to int * reverted change in homeassistant/components/dyson/sensor.py added both values to the mock device (volatil and volatile)
This commit is contained in:
7 files changed
+52
-94
No files matched your search
@@ -0,0 +1,25 @@
|
||||
"""Common utils for Dyson tests."""
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from libpurecool.dyson_pure_cool import FanSpeed
|
||||
|
||||
|
||||
def load_mock_device(device):
|
||||
"""Load the mock with default values so it doesn't throw errors."""
|
||||
device.serial = "XX-XXXXX-XX"
|
||||
device.name = "Temp Name"
|
||||
device.connect = mock.Mock(return_value=True)
|
||||
device.auto_connect = mock.Mock(return_value=True)
|
||||
device.environmental_state.particulate_matter_25 = "0000"
|
||||
device.environmental_state.particulate_matter_10 = "0000"
|
||||
device.environmental_state.nitrogen_dioxide = "0000"
|
||||
device.environmental_state.volatil_organic_compounds = "0000"
|
||||
device.environmental_state.volatile_organic_compounds = "0000"
|
||||
device.environmental_state.temperature = 250
|
||||
device.state.hepa_filter_state = 0
|
||||
device.state.carbon_filter_state = 0
|
||||
device.state.speed = FanSpeed.FAN_SPEED_1.value
|
||||
device.state.oscillation_angle_low = "000"
|
||||
device.state.oscillation_angle_high = "000"
|
||||
device.state.filter_life = "000"
|
||||
Reference in new issue
Block a user