|
4 | 4 |
|
5 | 5 | import pytest |
6 | 6 |
|
7 | | -from deebot_client.command import CommandResult |
8 | | -from deebot_client.commands.xml import GetFanSpeed |
| 7 | +from deebot_client.command import CommandResult, CommandWithMessageHandling |
| 8 | +from deebot_client.commands.xml import GetCleanSpeed, SetCleanSpeed |
9 | 9 | from deebot_client.events import FanSpeedEvent, FanSpeedLevel |
10 | 10 | from deebot_client.message import HandlingState |
11 | 11 | from tests.commands import assert_command |
|
26 | 26 | ) |
27 | 27 | async def test_get_fan_speed(speed: str, expected_event: Event) -> None: |
28 | 28 | json = get_request_xml(f"<ctl ret='ok' speed='{speed}'/>") |
29 | | - await assert_command(GetFanSpeed(), json, expected_event) |
| 29 | + await assert_command(GetCleanSpeed(), json, expected_event) |
30 | 30 |
|
31 | 31 |
|
32 | 32 | @pytest.mark.parametrize( |
33 | 33 | "xml", |
34 | | - ["<ctl ret='error'/>", "<ctl ret='ok' speed='invalid'/>"], |
35 | | - ids=["error", "no_state"], |
| 34 | + ["<ctl ret='error'/>"], |
| 35 | + ids=["error"], |
36 | 36 | ) |
37 | 37 | async def test_get_fan_speed_error(xml: str) -> None: |
38 | 38 | json = get_request_xml(xml) |
39 | 39 | await assert_command( |
40 | | - GetFanSpeed(), |
| 40 | + GetCleanSpeed(), |
41 | 41 | json, |
42 | 42 | None, |
43 | 43 | command_result=CommandResult(HandlingState.ANALYSE_LOGGED), |
44 | 44 | ) |
| 45 | + |
| 46 | + |
| 47 | +@pytest.mark.parametrize( |
| 48 | + ("command", "xml", "result"), |
| 49 | + [ |
| 50 | + ( |
| 51 | + SetCleanSpeed(FanSpeedLevel.MAX), |
| 52 | + "<ctl ret='ok' />", |
| 53 | + HandlingState.SUCCESS, |
| 54 | + ), |
| 55 | + ], |
| 56 | +) |
| 57 | +async def test_set_fan_speed( |
| 58 | + command: CommandWithMessageHandling, xml: str, result: HandlingState |
| 59 | +) -> None: |
| 60 | + json = get_request_xml(xml) |
| 61 | + await assert_command(command, json, None, command_result=CommandResult(result)) |
0 commit comments