mirror of
https://github.com/home-assistant/core.git
synced 2025-08-22 05:52:31 +02:00
test TimeoutException
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user