Skip to content

Commit 92509b4

Browse files
committed
Add pytest
1 parent 906c24f commit 92509b4

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/api/test_root.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
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
79
from supervisor.coresys import CoreSys
@@ -78,3 +80,18 @@ async def test_api_refresh_updates(api_client, coresys: CoreSys):
7880

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

0 commit comments

Comments
 (0)