1
1
from unittest .mock import patch
2
2
3
3
import paho .mqtt .client as mqtt
4
- import pytest
5
4
6
5
from roborock import (
7
6
HomeData ,
@@ -24,13 +23,12 @@ def test_can_create_prepared_request():
24
23
PreparedRequest ("https://sample.com" )
25
24
26
25
27
- def test_can_create_mqtt_roborock ():
26
+ async def test_can_create_mqtt_roborock ():
28
27
home_data = HomeData .from_dict (HOME_DATA_RAW )
29
28
device_info = DeviceData (device = home_data .devices [0 ], model = home_data .products [0 ].model )
30
29
RoborockMqttClientV1 (UserData .from_dict (USER_DATA ), device_info )
31
30
32
31
33
- @pytest .mark .asyncio
34
32
async def test_sync_connect (mqtt_client ):
35
33
with patch ("paho.mqtt.client.Client.connect" , return_value = mqtt .MQTT_ERR_SUCCESS ):
36
34
with patch ("paho.mqtt.client.Client.loop_start" , return_value = mqtt .MQTT_ERR_SUCCESS ):
@@ -41,7 +39,6 @@ async def test_sync_connect(mqtt_client):
41
39
connected_future .cancel ()
42
40
43
41
44
- @pytest .mark .asyncio
45
42
async def test_get_base_url_no_url ():
46
43
rc = RoborockApiClient (
"[email protected] " )
47
44
with patch ("roborock.web_api.PreparedRequest.request" ) as mock_request :
@@ -50,7 +47,6 @@ async def test_get_base_url_no_url():
50
47
assert rc .base_url == "https://sample.com"
51
48
52
49
53
- @pytest .mark .asyncio
54
50
async def test_request_code ():
55
51
rc = RoborockApiClient (
"[email protected] " )
56
52
with patch ("roborock.web_api.RoborockApiClient._get_base_url" ), patch (
@@ -60,7 +56,6 @@ async def test_request_code():
60
56
await rc .request_code ()
61
57
62
58
63
- @pytest .mark .asyncio
64
59
async def test_get_home_data ():
65
60
rc = RoborockApiClient (
"[email protected] " )
66
61
with patch ("roborock.web_api.RoborockApiClient._get_base_url" ), patch (
@@ -77,7 +72,6 @@ async def test_get_home_data():
77
72
assert result == HomeData .from_dict (HOME_DATA_RAW )
78
73
79
74
80
- @pytest .mark .asyncio
81
75
async def test_get_dust_collection_mode ():
82
76
home_data = HomeData .from_dict (HOME_DATA_RAW )
83
77
device_info = DeviceData (device = home_data .devices [0 ], model = home_data .products [0 ].model )
@@ -89,7 +83,6 @@ async def test_get_dust_collection_mode():
89
83
assert dust .mode == RoborockDockDustCollectionModeCode .light
90
84
91
85
92
- @pytest .mark .asyncio
93
86
async def test_get_mop_wash_mode ():
94
87
home_data = HomeData .from_dict (HOME_DATA_RAW )
95
88
device_info = DeviceData (device = home_data .devices [0 ], model = home_data .products [0 ].model )
@@ -102,7 +95,6 @@ async def test_get_mop_wash_mode():
102
95
assert mop_wash .wash_interval == 1500
103
96
104
97
105
- @pytest .mark .asyncio
106
98
async def test_get_washing_mode ():
107
99
home_data = HomeData .from_dict (HOME_DATA_RAW )
108
100
device_info = DeviceData (device = home_data .devices [0 ], model = home_data .products [0 ].model )
@@ -115,7 +107,6 @@ async def test_get_washing_mode():
115
107
assert washing_mode .wash_mode == 2
116
108
117
109
118
- @pytest .mark .asyncio
119
110
async def test_get_prop ():
120
111
home_data = HomeData .from_dict (HOME_DATA_RAW )
121
112
device_info = DeviceData (device = home_data .devices [0 ], model = home_data .products [0 ].model )
0 commit comments