Skip to content

Commit cf6a196

Browse files
authored
test: fix sync_connect test (#104)
1 parent 45f5c58 commit cf6a196

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_api.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,15 @@ def test_can_create_mqtt_roborock():
3030
RoborockMqttClient(UserData.from_dict(USER_DATA), device_info)
3131

3232

33-
def test_sync_connect(mqtt_client):
33+
@pytest.mark.asyncio
34+
async def test_sync_connect(mqtt_client):
3435
with patch("paho.mqtt.client.Client.connect", return_value=mqtt.MQTT_ERR_SUCCESS):
3536
with patch("paho.mqtt.client.Client.loop_start", return_value=mqtt.MQTT_ERR_SUCCESS):
36-
mqtt_client.sync_connect()
37+
connecting, connected_future = mqtt_client.sync_connect()
38+
assert connecting is True
39+
assert connected_future is not None
40+
41+
connected_future.cancel()
3742

3843

3944
@pytest.mark.asyncio

0 commit comments

Comments
 (0)