Generate a seperate UUID for the analytics integration (#48742)

This commit is contained in:
Joakim Sørensen 2021-04-07 02:34:49 +02:00 committed by GitHub
parent 82cc5148d7
commit 89f2f458d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 42 deletions

View file

@ -1,6 +1,4 @@
"""The tests for the analytics ."""
from unittest.mock import patch
from homeassistant.components.analytics.const import ANALYTICS_ENDPOINT_URL, DOMAIN
from homeassistant.setup import async_setup_component
@ -22,11 +20,9 @@ async def test_websocket(hass, hass_ws_client, aioclient_mock):
ws_client = await hass_ws_client(hass)
await ws_client.send_json({"id": 1, "type": "analytics"})
with patch("homeassistant.helpers.instance_id.async_get", return_value="abcdef"):
response = await ws_client.receive_json()
response = await ws_client.receive_json()
assert response["success"]
assert response["result"]["huuid"] == "abcdef"
await ws_client.send_json(
{"id": 2, "type": "analytics/preferences", "preferences": {"base": True}}
@ -36,7 +32,5 @@ async def test_websocket(hass, hass_ws_client, aioclient_mock):
assert response["result"]["preferences"]["base"]
await ws_client.send_json({"id": 3, "type": "analytics"})
with patch("homeassistant.helpers.instance_id.async_get", return_value="abcdef"):
response = await ws_client.receive_json()
response = await ws_client.receive_json()
assert response["result"]["preferences"]["base"]
assert response["result"]["huuid"] == "abcdef"