Add light tests for devolo_home_control (#74183)
This commit is contained in:
parent
3970639c34
commit
43595f7e17
3 changed files with 206 additions and 1 deletions
|
@ -8,6 +8,9 @@ from devolo_home_control_api.homecontrol import HomeControl
|
|||
from devolo_home_control_api.properties.binary_sensor_property import (
|
||||
BinarySensorProperty,
|
||||
)
|
||||
from devolo_home_control_api.properties.binary_switch_property import (
|
||||
BinarySwitchProperty,
|
||||
)
|
||||
from devolo_home_control_api.properties.multi_level_sensor_property import (
|
||||
MultiLevelSensorProperty,
|
||||
)
|
||||
|
@ -31,6 +34,15 @@ class BinarySensorPropertyMock(BinarySensorProperty):
|
|||
self.state = False
|
||||
|
||||
|
||||
class BinarySwitchPropertyMock(BinarySwitchProperty):
|
||||
"""devolo Home Control binary sensor mock."""
|
||||
|
||||
def __init__(self, **kwargs: Any) -> None:
|
||||
"""Initialize the mock."""
|
||||
self._logger = MagicMock()
|
||||
self.element_uid = "Test"
|
||||
|
||||
|
||||
class MultiLevelSensorPropertyMock(MultiLevelSensorProperty):
|
||||
"""devolo Home Control multi level sensor mock."""
|
||||
|
||||
|
@ -134,6 +146,22 @@ class CoverMock(DeviceMock):
|
|||
}
|
||||
|
||||
|
||||
class LightMock(DeviceMock):
|
||||
"""devolo Home Control light device mock."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the mock."""
|
||||
super().__init__()
|
||||
self.binary_switch_property = {}
|
||||
self.multi_level_switch_property = {
|
||||
"devolo.Dimmer:Test": MultiLevelSwitchPropertyMock()
|
||||
}
|
||||
self.multi_level_switch_property["devolo.Dimmer:Test"].switch_type = "dimmer"
|
||||
self.multi_level_switch_property[
|
||||
"devolo.Dimmer:Test"
|
||||
].element_uid = "devolo.Dimmer:Test"
|
||||
|
||||
|
||||
class RemoteControlMock(DeviceMock):
|
||||
"""devolo Home Control remote control device mock."""
|
||||
|
||||
|
@ -219,6 +247,19 @@ class HomeControlMockCover(HomeControlMock):
|
|||
self.publisher.unregister = MagicMock()
|
||||
|
||||
|
||||
class HomeControlMockLight(HomeControlMock):
|
||||
"""devolo Home Control gateway mock with light devices."""
|
||||
|
||||
def __init__(self, **kwargs: Any) -> None:
|
||||
"""Initialize the mock."""
|
||||
super().__init__()
|
||||
self.devices = {
|
||||
"Test": LightMock(),
|
||||
}
|
||||
self.publisher = Publisher(self.devices.keys())
|
||||
self.publisher.unregister = MagicMock()
|
||||
|
||||
|
||||
class HomeControlMockRemoteControl(HomeControlMock):
|
||||
"""devolo Home Control gateway mock with remote control device."""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue