mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-24 12:29:08 +00:00
Add dedicated version update refresh for main components (#5833)
* Add dedicated update information reload Currently we have the /refresh_updates endpoint which updates the main component versions (Core, OS, Supervisor, Plug-ins) and the add-on store at the same time. This combined update causes more update information reloads than necessary. To allow fine grained update refresh control introduce a new endpoint /reload_updates which asks Supervisor to only update main component versions (learned through the version json files). The /store/reload endpoint already allows to update the add-on store separately. * Add pytest * Update supervisor/api/__init__.py
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
"""Test Supervisor API."""
|
||||
|
||||
# pylint: disable=protected-access
|
||||
from unittest.mock import AsyncMock
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from aiohttp.test_utils import TestClient
|
||||
|
||||
from supervisor.api.const import ATTR_AVAILABLE_UPDATES
|
||||
from supervisor.coresys import CoreSys
|
||||
@@ -78,3 +80,18 @@ async def test_api_refresh_updates(api_client, coresys: CoreSys):
|
||||
|
||||
assert coresys.updater.reload.called
|
||||
assert coresys.store.reload.called
|
||||
|
||||
|
||||
async def test_api_reload_updates(
|
||||
coresys: CoreSys,
|
||||
api_client: TestClient,
|
||||
):
|
||||
"""Test reload updates."""
|
||||
with (
|
||||
patch("supervisor.updater.Updater.fetch_data") as fetch_data,
|
||||
):
|
||||
resp = await api_client.post("/reload_updates")
|
||||
|
||||
fetch_data.assert_called_once_with()
|
||||
|
||||
assert resp.status == 200
|
||||
|
||||
Reference in New Issue
Block a user