Skip to content

Commit 9ae9fb7

Browse files
author
NOisi-X
committed
Revert "fix: update tests for A01 QoS 1 and timestamp changes"
This reverts commit 613db33.
1 parent 613db33 commit 9ae9fb7

2 files changed

Lines changed: 4 additions & 18 deletions

File tree

tests/devices/traits/a01/test_init.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ async def test_dyad_api_query_values(dyad_api: DyadApi, fake_channel: FakeChanne
7777
assert message.protocol == RoborockMessageProtocol.RPC_REQUEST
7878
assert message.version == b"A01"
7979
payload_data = json.loads(unpad(message.payload, AES.block_size))
80-
assert payload_data["dps"] == {"10000": "[209, 201, 207, 214, 215, 227, 229, 230, 222, 224]"}
81-
assert "t" in payload_data
80+
assert payload_data == {"dps": {"10000": "[209, 201, 207, 214, 215, 227, 229, 230, 222, 224]"}}
8281

8382

8483
@pytest.mark.parametrize(
@@ -175,8 +174,7 @@ async def test_zeo_api_query_values(zeo_api: ZeoApi, fake_channel: FakeChannel):
175174
assert message.protocol == RoborockMessageProtocol.RPC_REQUEST
176175
assert message.version == b"A01"
177176
payload_data = json.loads(unpad(message.payload, AES.block_size))
178-
assert payload_data["dps"] == {"10000": "[203, 207, 226, 227, 224, 218]"}
179-
assert "t" in payload_data
177+
assert payload_data == {"dps": {"10000": "[203, 207, 226, 227, 224, 218]"}}
180178

181179

182180
@pytest.mark.parametrize(
@@ -247,8 +245,7 @@ async def test_dyad_api_set_value(dyad_api: DyadApi, fake_channel: FakeChannel):
247245
# decode the payload to verify contents
248246
payload_data = json.loads(unpad(message.payload, AES.block_size))
249247
# A01 protocol expects values to be strings in the dps dict
250-
assert payload_data["dps"] == {"209": 1}
251-
assert "t" in payload_data
248+
assert payload_data == {"dps": {"209": 1}}
252249

253250

254251
async def test_zeo_api_set_value(zeo_api: ZeoApi, fake_channel: FakeChannel):
@@ -264,5 +261,4 @@ async def test_zeo_api_set_value(zeo_api: ZeoApi, fake_channel: FakeChannel):
264261
# decode the payload to verify contents
265262
payload_data = json.loads(unpad(message.payload, AES.block_size))
266263
# A01 protocol expects values to be strings in the dps dict
267-
assert payload_data["dps"] == {"204": "standard"}
268-
assert "t" in payload_data
264+
assert payload_data == {"dps": {"204": "standard"}}

tests/e2e/test_device_manager.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ async def test_v1_device(
226226
test_topic = TEST_TOPIC_FORMAT.format(duid="abc123")
227227
mqtt_responses: list[bytes] = [
228228
*MQTT_DEFAULT_RESPONSES,
229-
# PUBACK for the QoS 1 publish (MID=2)
230-
mqtt_packet.gen_puback(mid=2),
231229
# ACK the GET_NETWORK_INFO call. id is deterministic based on deterministic_message_fixtures
232230
mqtt_packet.gen_publish(
233231
test_topic, mid=2, payload=response_builder.build_v1_rpc(data={"id": 9090, "result": NETWORK_INFO})
@@ -337,8 +335,6 @@ async def test_l01_device(
337335
test_topic = TEST_TOPIC_FORMAT.format(duid="abc123")
338336
mqtt_responses: list[bytes] = [
339337
*MQTT_DEFAULT_RESPONSES,
340-
# PUBACK for the QoS 1 publish (MID=2)
341-
mqtt_packet.gen_puback(mid=2),
342338
# ACK the GET_NETWORK_INFO call. id is deterministic based on deterministic_message_fixtures
343339
mqtt_packet.gen_publish(
344340
test_topic, mid=2, payload=mqtt_response_builder.build_v1_rpc(data={"id": 9090, "result": NETWORK_INFO})
@@ -470,14 +466,10 @@ async def test_q7_device(
470466
test_topic = TEST_TOPIC_FORMAT.format(duid="device-id-q7")
471467
mqtt_responses: list[bytes] = [
472468
*MQTT_DEFAULT_RESPONSES,
473-
# PUBACK for the QoS 1 query publish (MID=2)
474-
mqtt_packet.gen_puback(mid=2),
475469
# ACK the Query status call sent below. id is deterministic based on deterministic_message_fixtures
476470
mqtt_packet.gen_publish(
477471
test_topic, mid=2, payload=response_builder.build_b01_q7_rpc({"status": 2}, msg_id=9090)
478472
),
479-
# PUBACK for the QoS 1 start clean publish (MID=3)
480-
mqtt_packet.gen_puback(mid=3),
481473
# ACK the start clean call sent below. id is deterministic based on deterministic_message_fixtures
482474
mqtt_packet.gen_publish(test_topic, mid=2, payload=response_builder.build_b01_q7_rpc("ok", msg_id=9093)),
483475
]
@@ -535,8 +527,6 @@ async def test_a01_device(
535527
test_topic = TEST_TOPIC_FORMAT.format(duid="zeo_duid")
536528
mqtt_responses: list[bytes] = [
537529
*MQTT_DEFAULT_RESPONSES,
538-
# PUBACK for the QoS 1 publish (MID=2, matches the query publish below)
539-
mqtt_packet.gen_puback(mid=2),
540530
# ACK the Query state call sent below. id is deterministic based on deterministic_message_fixtures
541531
mqtt_packet.gen_publish(test_topic, mid=2, payload=response_builder.build_a01_rpc({"203": 6})),
542532
]

0 commit comments

Comments
 (0)