test TimeoutException

This commit is contained in:
Thomas Protzner
2024-08-12 17:43:42 +00:00
parent 99c82f4b83
commit 3ccdbc342a

View File

@@ -9,6 +9,7 @@ from aioautomower.exceptions import (
ApiException, ApiException,
AuthException, AuthException,
HusqvarnaWSServerHandshakeError, HusqvarnaWSServerHandshakeError,
TimeoutException,
) )
from freezegun.api import FrozenDateTimeFactory from freezegun.api import FrozenDateTimeFactory
import pytest import pytest
@@ -158,10 +159,8 @@ async def test_websocket_not_available(
await hass.async_block_till_done() await hass.async_block_till_done()
assert mock_automower_client.start_listening.call_count == 1 assert mock_automower_client.start_listening.call_count == 1
# Test reconnection after another disconnect # Simulate a start_listening TimeoutException
mock_automower_client.auth.websocket_connect.side_effect = ( mock_automower_client.start_listening.side_effect = TimeoutException("Boom")
HusqvarnaWSServerHandshakeError("Boom")
)
await hass.async_block_till_done() await hass.async_block_till_done()
assert ( assert (
mock_automower_client.auth.websocket_connect.call_count mock_automower_client.auth.websocket_connect.call_count