hass-core/tests/components/dyson/common.py
etheralm f8de0594b9
Add support for Dyson Pure HP04 purifying heater + fan (#34537)
* fix unnecesary checks

* change ClimateDevice to ClimateEntity

* Clean up

* Formatting

* Fix tests

* Clean tests

* Clean up tests

* Fix device mock

* Use safer patch target path

* Extract constant

* Remove not needed property

* Guard for missing target temperature

* Use async_mock mocks

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-06-16 05:31:11 +01:00

26 lines
1 KiB
Python

"""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"
device.state.heat_target = 200