Add memory/cpu percentage to Supervisor addons entities (#57468)

* Add memory/cpu percentage to Supervisor addons entities

* fixed lint

* Use a single update function. Fixed tests

* use constant

* review comments

* oops
This commit is contained in:
avee87
2021-10-22 12:23:21 +02:00
committed by GitHub
parent 61e093cecd
commit a0bb2c8b33
9 changed files with 383 additions and 67 deletions
+12
View File
@@ -177,6 +177,18 @@ async def test_api_addon_info(hassio_handler, aioclient_mock):
assert aioclient_mock.call_count == 1
async def test_api_addon_stats(hassio_handler, aioclient_mock):
"""Test setup with API Add-on stats."""
aioclient_mock.get(
"http://127.0.0.1/addons/test/stats",
json={"result": "ok", "data": {"memory_percent": 0.01}},
)
data = await hassio_handler.get_addon_stats("test")
assert data["memory_percent"] == 0.01
assert aioclient_mock.call_count == 1
async def test_api_discovery_message(hassio_handler, aioclient_mock):
"""Test setup with API discovery message."""
aioclient_mock.get(