Add arch to payload (#51330)

This commit is contained in:
Joakim Sørensen 2021-06-01 15:09:23 +02:00 committed by GitHub
parent f3715cef6d
commit fb281c6bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -21,6 +21,7 @@ from .const import (
ANALYTICS_ENDPOINT_URL_DEV,
ATTR_ADDON_COUNT,
ATTR_ADDONS,
ATTR_ARCH,
ATTR_AUTO_UPDATE,
ATTR_AUTOMATION_COUNT,
ATTR_BASE,
@ -157,6 +158,7 @@ class Analytics:
payload[ATTR_SUPERVISOR] = {
ATTR_HEALTHY: supervisor_info[ATTR_HEALTHY],
ATTR_SUPPORTED: supervisor_info[ATTR_SUPPORTED],
ATTR_ARCH: supervisor_info[ATTR_ARCH],
}
if operating_system_info.get(ATTR_BOARD) is not None:

View File

@ -16,6 +16,7 @@ LOGGER: logging.Logger = logging.getLogger(__package__)
ATTR_ADDON_COUNT = "addon_count"
ATTR_ADDONS = "addons"
ATTR_ARCH = "arch"
ATTR_AUTO_UPDATE = "auto_update"
ATTR_AUTOMATION_COUNT = "automation_count"
ATTR_BASE = "base"

View File

@ -132,7 +132,9 @@ async def test_send_base_with_supervisor(hass, caplog, aioclient_mock):
with patch(
"homeassistant.components.hassio.get_supervisor_info",
side_effect=Mock(return_value={"supported": True, "healthy": True}),
side_effect=Mock(
return_value={"supported": True, "healthy": True, "arch": "amd64"}
),
), patch(
"homeassistant.components.hassio.get_os_info",
side_effect=Mock(return_value={"board": "blue", "version": "123"}),
@ -157,7 +159,10 @@ async def test_send_base_with_supervisor(hass, caplog, aioclient_mock):
assert f"'uuid': '{MOCK_UUID}'" in caplog.text
assert f"'version': '{MOCK_VERSION}'" in caplog.text
assert "'supervisor': {'healthy': True, 'supported': True}" in caplog.text
assert (
"'supervisor': {'healthy': True, 'supported': True, 'arch': 'amd64'}"
in caplog.text
)
assert "'operating_system': {'board': 'blue', 'version': '123'}" in caplog.text
assert "'installation_type':" in caplog.text
assert "'integration_count':" not in caplog.text
@ -197,6 +202,7 @@ async def test_send_usage_with_supervisor(hass, caplog, aioclient_mock):
return_value={
"healthy": True,
"supported": True,
"arch": "amd64",
"addons": [{"slug": "test_addon"}],
}
),
@ -303,6 +309,7 @@ async def test_send_statistics_with_supervisor(hass, caplog, aioclient_mock):
return_value={
"healthy": True,
"supported": True,
"arch": "amd64",
"addons": [{"slug": "test_addon"}],
}
),