reset mock

This commit is contained in:
Thomas Protzner
2024-08-12 17:26:26 +00:00
parent b10ce49222
commit dec1b0fc4c

View File

@@ -148,16 +148,12 @@ async def test_websocket_not_available(
) )
# Initial call count and range for reconnection attempts # Initial call count and range for reconnection attempts
start_call_count = mock_automower_client.auth.websocket_connect.call_count
test_range = 945 - start_call_count
mock_automower_client.reset_mock()
# Perform reconnection attempts # Perform reconnection attempts
for count in range(1, test_range): for count in range(1, 945):
await hass.async_block_till_done() await hass.async_block_till_done()
assert ( assert mock_automower_client.auth.websocket_connect.call_count == count
mock_automower_client.auth.websocket_connect.call_count
== start_call_count + count
)
assert mock_config_entry.state is ConfigEntryState.LOADED assert mock_config_entry.state is ConfigEntryState.LOADED
# Simulate a successful connection # Simulate a successful connection
@@ -174,10 +170,7 @@ async def test_websocket_not_available(
freezer.tick(timedelta(seconds=0)) freezer.tick(timedelta(seconds=0))
async_fire_time_changed(hass) async_fire_time_changed(hass)
await hass.async_block_till_done() await hass.async_block_till_done()
assert ( assert mock_automower_client.auth.websocket_connect.call_count == 946
mock_automower_client.auth.websocket_connect.call_count
== start_call_count + test_range + 1
)
async def test_device_info( async def test_device_info(