Remove LG WebOS TV legacy uuid migration (#134671)

This commit is contained in:
Shay Levy 2025-01-04 16:31:36 +02:00 committed by GitHub
parent 7d146ddae0
commit fea4a00424
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 39 deletions

View File

@ -3,7 +3,6 @@
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any, Self
from urllib.parse import urlparse
@ -19,7 +18,6 @@ from homeassistant.config_entries import (
)
from homeassistant.const import CONF_CLIENT_SECRET, CONF_HOST, CONF_NAME
from homeassistant.core import callback
from homeassistant.data_entry_flow import AbortFlow
from homeassistant.helpers import config_validation as cv
from . import async_control_connect, update_client_key
@ -34,8 +32,6 @@ DATA_SCHEMA = vol.Schema(
extra=vol.ALLOW_EXTRA,
)
_LOGGER = logging.getLogger(__name__)
class FlowHandler(ConfigFlow, domain=DOMAIN):
"""WebosTV configuration flow."""
@ -68,28 +64,11 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
step_id="user", data_schema=DATA_SCHEMA, errors=errors
)
@callback
def _async_check_configured_entry(self) -> None:
"""Check if entry is configured, update unique_id if needed."""
for entry in self._async_current_entries(include_ignore=False):
if entry.data[CONF_HOST] != self._host:
continue
if self._uuid and not entry.unique_id:
_LOGGER.debug(
"Updating unique_id for host %s, unique_id: %s",
self._host,
self._uuid,
)
self.hass.config_entries.async_update_entry(entry, unique_id=self._uuid)
raise AbortFlow("already_configured")
async def async_step_pairing(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Display pairing form."""
self._async_check_configured_entry()
self._async_abort_entries_match({CONF_HOST: self._host})
self.context["title_placeholders"] = {"name": self._name}
errors = {}

View File

@ -11,7 +11,7 @@ rules:
config-flow-test-coverage: todo
config-flow:
status: todo
comment: remove duplicated config flow start in tests, make sure tests ends with CREATE_ENTRY or ABORT, remove legacy uuid migration, remove name parameter, use hass.config_entries.async_setup instead of async_setup_component, snapshot in diagnostics (and other tests when possible), test_client_disconnected validate no error in log, make reauth flow more graceful
comment: remove duplicated config flow start in tests, make sure tests ends with CREATE_ENTRY or ABORT, remove name parameter, use hass.config_entries.async_setup instead of async_setup_component, snapshot in diagnostics (and other tests when possible), test_client_disconnected validate no error in log, make reauth flow more graceful
dependency-transparency: done
docs-actions:
status: todo

View File

@ -218,22 +218,6 @@ async def test_ssdp_in_progress(hass: HomeAssistant, client) -> None:
assert result2["reason"] == "already_in_progress"
async def test_ssdp_update_uuid(hass: HomeAssistant, client) -> None:
"""Test that ssdp updates existing host entry uuid."""
entry = await setup_webostv(hass, None)
assert client
assert entry.unique_id is None
result = await hass.config_entries.flow.async_init(
DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=MOCK_DISCOVERY_INFO
)
await hass.async_block_till_done()
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
assert entry.unique_id == MOCK_DISCOVERY_INFO.upnp[ssdp.ATTR_UPNP_UDN][5:]
async def test_ssdp_not_update_uuid(hass: HomeAssistant, client) -> None:
"""Test that ssdp not updates different host."""
entry = await setup_webostv(hass, None)