forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed uncaught exceptions from Dyson (home-assistant#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)
- Loading branch information
Showing
7 changed files
with
52 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters