Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions aiohasupervisor/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,14 @@ async def reload_updates(self) -> None:
await self._client.post("reload_updates", timeout=ClientTimeout(total=300))

async def refresh_updates(self) -> None:
"""Refresh updates (discouraged)."""
"""Refresh updates.
Discouraged. Use the `reload_updates()` and `store.reload()` instead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say something about why it is discouraged.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Not sure if that is a good reason really, but it is why I plan to not use the endpoint from Core side anymore. With that, this endpoint likely has no users at all, so I'd rather prefer to remove it at one point.

"""
await self._client.post("refresh_updates", timeout=ClientTimeout(total=300))

async def available_updates(self) -> list[AvailableUpdate]:
"""Get available updates (discouraged)."""
"""Get available updates."""
result = await self._client.get("available_updates")
return AvailableUpdates.from_dict(result.data).available_updates

Expand Down
11 changes: 11 additions & 0 deletions tests/test_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ async def test_available_updates(
assert updates[1].update_type == UpdateType.OS


async def test_reload_updates(
responses: aioresponses, supervisor_client: SupervisorClient
) -> None:
"""Test reload updates API."""
responses.post(f"{SUPERVISOR_URL}/reload_updates", status=200)
assert await supervisor_client.reload_updates() is None
assert responses.requests.keys() == {
("POST", URL(f"{SUPERVISOR_URL}/reload_updates"))
}


async def test_refresh_updates(
responses: aioresponses, supervisor_client: SupervisorClient
) -> None:
Expand Down