Skip to content

Commit 115b7d6

Browse files
committed
Add pytest
1 parent 906c24f commit 115b7d6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tests/api/test_root.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
"""Test Supervisor API."""
22

33
# pylint: disable=protected-access
4-
from unittest.mock import AsyncMock
4+
from unittest.mock import AsyncMock, patch
5+
6+
from aiohttp.test_utils import TestClient
57

68
from supervisor.api.const import ATTR_AVAILABLE_UPDATES
9+
from supervisor.const import UpdateChannel
710
from supervisor.coresys import CoreSys
811

912
from tests.const import TEST_ADDON_SLUG
@@ -78,3 +81,19 @@ async def test_api_refresh_updates(api_client, coresys: CoreSys):
7881

7982
assert coresys.updater.reload.called
8083
assert coresys.store.reload.called
84+
85+
86+
async def test_api_reload_updates(
87+
coresys: CoreSys,
88+
api_client: TestClient,
89+
):
90+
"""Test reload updates."""
91+
coresys.updater.channel = UpdateChannel.STABLE
92+
with (
93+
patch("supervisor.updater.Updater.fetch_data") as fetch_data,
94+
):
95+
resp = await api_client.post("/reload_updates")
96+
97+
fetch_data.assert_called_once_with()
98+
99+
assert resp.status == 200

0 commit comments

Comments
 (0)