mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix more tests
This commit is contained in:
parent
dcefdc7bf2
commit
4e81f3ac15
@ -1,6 +1,5 @@
|
|||||||
"""Common tools used for the Tradfri test suite."""
|
"""Common tools used for the Tradfri test suite."""
|
||||||
|
|
||||||
from copy import deepcopy
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ class CommandStore:
|
|||||||
get_devices_command = gateway.get_devices()
|
get_devices_command = gateway.get_devices()
|
||||||
self.register_response(get_devices_command, [device_response.id])
|
self.register_response(get_devices_command, [device_response.id])
|
||||||
get_device_command = gateway.get_device(device_response.id)
|
get_device_command = gateway.get_device(device_response.id)
|
||||||
self.register_response(get_device_command, device_response.dict())
|
self.register_response(get_device_command, device_response.dict(by_alias=True))
|
||||||
|
|
||||||
def register_response(self, command: Command, response: Any) -> None:
|
def register_response(self, command: Command, response: Any) -> None:
|
||||||
"""Register command response."""
|
"""Register command response."""
|
||||||
@ -61,7 +60,7 @@ class CommandStore:
|
|||||||
assert observe_command
|
assert observe_command
|
||||||
|
|
||||||
device_path = "/".join(str(v) for v in device.path)
|
device_path = "/".join(str(v) for v in device.path)
|
||||||
device_state = deepcopy(device.raw)
|
device_state = device.raw.dict(by_alias=True)
|
||||||
|
|
||||||
# Create a default observed state based on the sent commands.
|
# Create a default observed state based on the sent commands.
|
||||||
for command in self.sent_commands:
|
for command in self.sent_commands:
|
||||||
|
@ -93,7 +93,7 @@ async def test_fan_available(
|
|||||||
ATTR_AIR_PURIFIER_MODE: 0,
|
ATTR_AIR_PURIFIER_MODE: 0,
|
||||||
},
|
},
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
None,
|
0,
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -145,7 +145,7 @@ async def test_fan_available(
|
|||||||
ATTR_AIR_PURIFIER_MODE: 0,
|
ATTR_AIR_PURIFIER_MODE: 0,
|
||||||
},
|
},
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
None,
|
0,
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user