mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix last test
This commit is contained in:
parent
4e81f3ac15
commit
68888100f6
@ -1,6 +1,10 @@
|
|||||||
"""Test the tradfri migration tools."""
|
"""Test the tradfri migration tools."""
|
||||||
|
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from pytradfri.device import Device
|
||||||
|
|
||||||
from homeassistant.components.tradfri.const import DOMAIN
|
from homeassistant.components.tradfri.const import DOMAIN
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.device_registry as dr
|
import homeassistant.helpers.device_registry as dr
|
||||||
@ -10,8 +14,11 @@ from . import GATEWAY_ID
|
|||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("device", ["air_purifier"], indirect=True)
|
||||||
async def test_migrate_device_identifier(
|
async def test_migrate_device_identifier(
|
||||||
hass: HomeAssistant, mock_api_factory: MagicMock
|
hass: HomeAssistant,
|
||||||
|
mock_api_factory: MagicMock,
|
||||||
|
device: Device,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test migrate device identifier."""
|
"""Test migrate device identifier."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
@ -27,12 +34,10 @@ async def test_migrate_device_identifier(
|
|||||||
device_registry = dr.async_get(hass)
|
device_registry = dr.async_get(hass)
|
||||||
device_entry = device_registry.async_get_or_create(
|
device_entry = device_registry.async_get_or_create(
|
||||||
config_entry_id=entry.entry_id,
|
config_entry_id=entry.entry_id,
|
||||||
identifiers={(DOMAIN, 1)}, # type: ignore[arg-type]
|
identifiers={(DOMAIN, 65551)}, # type: ignore[arg-type]
|
||||||
)
|
)
|
||||||
|
|
||||||
assert device_entry.identifiers == {(DOMAIN, 1)} # type: ignore[comparison-overlap]
|
assert device_entry.identifiers == {(DOMAIN, 65551)} # type: ignore[comparison-overlap]
|
||||||
|
|
||||||
# FIXME: We need to mock the pytradfri device on the gateway.
|
|
||||||
|
|
||||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
assert await hass.config_entries.async_setup(entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@ -40,4 +45,4 @@ async def test_migrate_device_identifier(
|
|||||||
migrated_device_entry = device_registry.async_get(device_entry.id)
|
migrated_device_entry = device_registry.async_get(device_entry.id)
|
||||||
|
|
||||||
assert migrated_device_entry
|
assert migrated_device_entry
|
||||||
assert migrated_device_entry.identifiers == {(DOMAIN, "1")}
|
assert migrated_device_entry.identifiers == {(DOMAIN, "65551")}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user