-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
97 additions
and
8 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,27 @@ | ||
"""Clean commands.""" | ||
|
||
from __future__ import annotations | ||
|
||
from deebot_client.models import CleanAction, CleanMode | ||
|
||
from .common import ExecuteCommand | ||
|
||
|
||
class CleanArea(ExecuteCommand): | ||
"""Clean area command.""" | ||
|
||
NAME = "Clean" | ||
HAS_SUB_ELEMENT = True | ||
|
||
def __init__(self, mode: CleanMode, area: str, cleanings: int = 1) -> None: | ||
# <ctl><clean type='SpotArea' act='s' speed='standard' deep='1' mid='4,5'/></ctl> | ||
|
||
super().__init__( | ||
{ | ||
"type": mode.xml_value, | ||
"act": CleanAction.START.xml_value, | ||
"speed": "standard", # TODO: FanSpeedLevel.NORMAL.xml_value, after #560 is merged | ||
"deep": str(cleanings), | ||
"mid": area, | ||
} | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
from deebot_client.command import CommandResult | ||
from deebot_client.commands.xml.clean import CleanArea | ||
from deebot_client.message import HandlingState | ||
from deebot_client.models import CleanMode | ||
from tests.commands import assert_command | ||
|
||
from . import get_request_xml | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("command", "command_result"), | ||
[ | ||
(CleanArea(CleanMode.SPOT_AREA, "4", 1), HandlingState.SUCCESS), | ||
], | ||
) | ||
async def test_CleanArea(command: CleanArea, command_result: HandlingState) -> None: | ||
json = get_request_xml("<ctl ret='ok'/>") | ||
await assert_command( | ||
command, json, None, command_result=CommandResult(command_result) | ||
) |