Add LED control support to Home Assistant Green (#100922)

* Add LED control support to Home Assistant Green

* Add strings.json

* Sort alphabetically

* Reorder LED schema

* Improve test coverage

* Apply suggestions from code review

Co-authored-by: Stefan Agner <stefan@agner.ch>

* Sort + fix test

* Remove reboot menu

---------

Co-authored-by: Stefan Agner <stefan@agner.ch>
This commit is contained in:
Erik Montnemery
2023-09-28 17:45:10 +02:00
committed by GitHub
parent d8520088e7
commit dc78d15abc
6 changed files with 336 additions and 1 deletions

View File

@@ -364,6 +364,48 @@ async def test_api_headers(
assert received_request.headers[hdrs.CONTENT_TYPE] == "application/octet-stream"
async def test_api_get_green_settings(
hass: HomeAssistant, hassio_stubs, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test setup with API ping."""
aioclient_mock.get(
"http://127.0.0.1/os/boards/green",
json={
"result": "ok",
"data": {
"activity_led": True,
"power_led": True,
"system_health_led": True,
},
},
)
assert await handler.async_get_green_settings(hass) == {
"activity_led": True,
"power_led": True,
"system_health_led": True,
}
assert aioclient_mock.call_count == 1
async def test_api_set_green_settings(
hass: HomeAssistant, hassio_stubs, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test setup with API ping."""
aioclient_mock.post(
"http://127.0.0.1/os/boards/green",
json={"result": "ok", "data": {}},
)
assert (
await handler.async_set_green_settings(
hass, {"activity_led": True, "power_led": True, "system_health_led": True}
)
== {}
)
assert aioclient_mock.call_count == 1
async def test_api_get_yellow_settings(
hass: HomeAssistant, hassio_stubs, aioclient_mock: AiohttpClientMocker
) -> None: