|
3 | 3 | from datetime import UTC, datetime |
4 | 4 |
|
5 | 5 | from aioresponses import aioresponses |
| 6 | +import pytest |
6 | 7 | from yarl import URL |
7 | 8 |
|
8 | 9 | from aiohasupervisor import SupervisorClient |
9 | | -from aiohasupervisor.models import HostOptions |
| 10 | +from aiohasupervisor.models import HostOptions, RebootOptions, ShutdownOptions |
10 | 11 |
|
11 | 12 | from . import load_fixture |
12 | 13 | from .const import SUPERVISOR_URL |
@@ -46,21 +47,27 @@ async def test_host_info( |
46 | 47 | assert result.startup_time == 1.966311 |
47 | 48 |
|
48 | 49 |
|
| 50 | +@pytest.mark.parametrize("options", [None, RebootOptions(force=True)]) |
49 | 51 | async def test_host_reboot( |
50 | | - responses: aioresponses, supervisor_client: SupervisorClient |
| 52 | + responses: aioresponses, |
| 53 | + supervisor_client: SupervisorClient, |
| 54 | + options: RebootOptions | None, |
51 | 55 | ) -> None: |
52 | 56 | """Test host reboot API.""" |
53 | 57 | responses.post(f"{SUPERVISOR_URL}/host/reboot", status=200) |
54 | | - assert await supervisor_client.host.reboot() is None |
| 58 | + assert await supervisor_client.host.reboot(options) is None |
55 | 59 | assert responses.requests.keys() == {("POST", URL(f"{SUPERVISOR_URL}/host/reboot"))} |
56 | 60 |
|
57 | 61 |
|
| 62 | +@pytest.mark.parametrize("options", [None, ShutdownOptions(force=True)]) |
58 | 63 | async def test_host_shutdown( |
59 | | - responses: aioresponses, supervisor_client: SupervisorClient |
| 64 | + responses: aioresponses, |
| 65 | + supervisor_client: SupervisorClient, |
| 66 | + options: ShutdownOptions | None, |
60 | 67 | ) -> None: |
61 | 68 | """Test host shutdown API.""" |
62 | 69 | responses.post(f"{SUPERVISOR_URL}/host/shutdown", status=200) |
63 | | - assert await supervisor_client.host.shutdown() is None |
| 70 | + assert await supervisor_client.host.shutdown(options) is None |
64 | 71 | assert responses.requests.keys() == { |
65 | 72 | ("POST", URL(f"{SUPERVISOR_URL}/host/shutdown")) |
66 | 73 | } |
|
0 commit comments