Update error handling in update coordinator (#32452)
This commit is contained in:
parent
f62322cfb4
commit
b27c46750c
8 changed files with 58 additions and 67 deletions
|
@ -1,5 +1,4 @@
|
|||
"""The tests for the Updater component."""
|
||||
import asyncio
|
||||
from unittest.mock import Mock
|
||||
|
||||
from asynctest import patch
|
||||
|
@ -130,17 +129,6 @@ async def test_get_newest_version_analytics_when_huuid(hass, aioclient_mock):
|
|||
assert res == (MOCK_RESPONSE["version"], MOCK_RESPONSE["release-notes"])
|
||||
|
||||
|
||||
async def test_error_fetching_new_version_timeout(hass):
|
||||
"""Test we handle timeout error while fetching new version."""
|
||||
with patch(
|
||||
"homeassistant.helpers.system_info.async_get_system_info",
|
||||
Mock(return_value=mock_coro({"fake": "bla"})),
|
||||
), patch("async_timeout.timeout", side_effect=asyncio.TimeoutError), pytest.raises(
|
||||
UpdateFailed
|
||||
):
|
||||
await updater.get_newest_version(hass, MOCK_HUUID, False)
|
||||
|
||||
|
||||
async def test_error_fetching_new_version_bad_json(hass, aioclient_mock):
|
||||
"""Test we handle json error while fetching new version."""
|
||||
aioclient_mock.post(updater.UPDATER_URL, text="not json")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue