-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new command: "VoiceAssistantState" (#347)
- Loading branch information
1 parent
19a9684
commit 8f6e947
Showing
5 changed files
with
54 additions
and
0 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
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,19 @@ | ||
"""Voice assistant state command module.""" | ||
|
||
from deebot_client.events import VoiceAssistantStateEvent | ||
|
||
from .common import GetEnableCommand, SetEnableCommand | ||
|
||
|
||
class GetVoiceAssistantState(GetEnableCommand): | ||
"""Get voice assistant state command.""" | ||
|
||
name = "getVoiceAssistantState" | ||
event_type = VoiceAssistantStateEvent | ||
|
||
|
||
class SetVoiceAssistantState(SetEnableCommand): | ||
"""Set voice assistant state command.""" | ||
|
||
name = "setVoiceAssistantState" | ||
get_command = GetVoiceAssistantState |
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,22 @@ | ||
import pytest | ||
|
||
from deebot_client.commands.json import GetVoiceAssistantState, SetVoiceAssistantState | ||
from deebot_client.events import VoiceAssistantStateEvent | ||
from tests.helpers import get_request_json, get_success_body | ||
|
||
from . import assert_command, assert_set_enable_command | ||
|
||
|
||
@pytest.mark.parametrize("value", [False, True]) | ||
async def test_GetTrueDetect(value: bool) -> None: | ||
json = get_request_json(get_success_body({"enable": 1 if value else 0})) | ||
await assert_command( | ||
GetVoiceAssistantState(), json, VoiceAssistantStateEvent(value) | ||
) | ||
|
||
|
||
@pytest.mark.parametrize("value", [False, True]) | ||
async def test_SetTrueDetect(value: bool) -> None: | ||
await assert_set_enable_command( | ||
SetVoiceAssistantState(value), value, VoiceAssistantStateEvent | ||
) |