11from __future__ import annotations
22
33from collections .abc import Sequence
4- import json
54from typing import TYPE_CHECKING , Any
65from unittest .mock import Mock , call
76
7+ import orjson
88from testfixtures import LogCapture
99
1010from deebot_client .event_bus import EventBus
@@ -94,13 +94,13 @@ async def assert_set_command(
9494 "msg" : "fail" ,
9595 }
9696 )
97- command .handle_mqtt_p2p (event_bus , json .dumps (json_data ))
97+ command .handle_mqtt_p2p (event_bus , orjson .dumps (json_data ))
9898 event_bus .notify .assert_called_once_with (firmware_event )
9999
100100 event_bus .reset_mock ()
101101 # Success
102102 data , firmware_event = get_message_json (get_success_body ())
103- command .handle_mqtt_p2p (event_bus , json .dumps (data ))
103+ command .handle_mqtt_p2p (event_bus , orjson .dumps (data ))
104104 if not isinstance (expected_get_command_events , Sequence ):
105105 expected_events = [firmware_event , expected_get_command_events ]
106106 else :
@@ -109,7 +109,7 @@ async def assert_set_command(
109109 event_bus .notify .assert_has_calls ([call (x ) for x in expected_events ])
110110 assert event_bus .notify .call_count == len (expected_events )
111111
112- payload = json .dumps ({"body" : {"data" : args }})
112+ payload = orjson .dumps ({"body" : {"data" : args }})
113113 mqtt_command = command .create_from_mqtt (payload )
114114 assert mqtt_command == command
115115
0 commit comments