Add unique id for Scrape config entry entities (#82508)

* scrape unique id

* fix uuid str

* add back UoM
This commit is contained in:
G Johansson 2022-11-24 21:12:47 +01:00 committed by GitHub
parent e4fbbdfa05
commit a63581b5c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 2 deletions

View file

@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Any
from unittest.mock import patch
import uuid
import pytest
@ -15,6 +16,7 @@ from homeassistant.const import (
CONF_NAME,
CONF_RESOURCE,
CONF_TIMEOUT,
CONF_UNIQUE_ID,
CONF_VERIFY_SSL,
)
from homeassistant.core import HomeAssistant
@ -41,6 +43,7 @@ async def get_config_to_integration_load() -> dict[str, Any]:
CONF_NAME: "Current version",
CONF_SELECT: ".current-version h1",
CONF_INDEX: 0,
CONF_UNIQUE_ID: "3699ef88-69e6-11ed-a1eb-0242ac120002",
}
],
}
@ -78,3 +81,13 @@ async def load_integration(
await hass.async_block_till_done()
return config_entry
@pytest.fixture(autouse=True)
def uuid_fixture() -> str:
"""Automatically path uuid generator."""
with patch(
"homeassistant.components.scrape.config_flow.uuid.uuid1",
return_value=uuid.UUID("3699ef88-69e6-11ed-a1eb-0242ac120002"),
):
yield