11"""Tests for the Roborock Local Client V1."""
22
3- from queue import Queue
4- from unittest .mock import patch
53import json
6- from typing import Any
74from collections .abc import AsyncGenerator
5+ from queue import Queue
6+ from typing import Any
7+ from unittest .mock import patch
88
99import pytest
1010
11+ from roborock .containers import RoomMapping
1112from roborock .protocol import MessageParser
1213from roborock .roborock_message import RoborockMessage , RoborockMessageProtocol
1314from roborock .version_1_apis import RoborockLocalClientV1
14- from roborock .containers import DeviceData , RoomMapping , S7MaxVStatus
1515
1616from .mock_data import LOCAL_KEY
1717
@@ -28,6 +28,7 @@ def build_rpc_response(seq: int, message: dict[str, Any]) -> bytes:
2828 ).encode (),
2929 )
3030
31+
3132def build_raw_response (protocol : RoborockMessageProtocol , seq : int , payload : bytes ) -> bytes :
3233 """Build an encoded RPC response message."""
3334 message = RoborockMessage (
@@ -56,10 +57,10 @@ async def test_async_connect(
5657 assert not local_client .is_connected ()
5758
5859
59-
6060@pytest .fixture (name = "connected_local_client" )
6161async def connected_local_client_fixture (
62- response_queue : Queue , local_client : RoborockLocalClientV1 ,
62+ response_queue : Queue ,
63+ local_client : RoborockLocalClientV1 ,
6364) -> AsyncGenerator [RoborockLocalClientV1 , None ]:
6465 response_queue .put (build_raw_response (RoborockMessageProtocol .HELLO_RESPONSE , 1 , b"ignored" ))
6566 response_queue .put (build_raw_response (RoborockMessageProtocol .PING_RESPONSE , 2 , b"ignored" ))
@@ -79,8 +80,8 @@ async def test_get_room_mapping(
7980 message = build_rpc_response (
8081 seq = test_request_id ,
8182 message = {
82- "id" : test_request_id ,
83- "result" : [[16 , "2362048" ], [17 , "2362044" ]],
83+ "id" : test_request_id ,
84+ "result" : [[16 , "2362048" ], [17 , "2362044" ]],
8485 },
8586 )
8687 response_queue .put (message )
0 commit comments