Validate slug in addon services (#99232)

* Validate slug in addon services

* Move validator into hassio component

* Fixes from mypy

* Fix test for changes

* Adjust fixtures to current supervisor

* Fix call counts after fixture adjustment

* Increase coverage
This commit is contained in:
Mike Degatano
2023-08-29 13:57:41 -04:00
committed by GitHub
parent e2dd7f2069
commit e0eb63c588
4 changed files with 95 additions and 41 deletions

View File

@@ -413,3 +413,10 @@ async def test_api_reboot_host(
assert await handler.async_reboot_host(hass) == {}
assert aioclient_mock.call_count == 1
async def test_send_command_invalid_command(hass: HomeAssistant, hassio_stubs) -> None:
"""Test send command fails when command is invalid."""
hassio: HassIO = hass.data["hassio"]
with pytest.raises(HassioAPIError):
await hassio.send_command("/test/../bad")