mirror of
https://github.com/home-assistant/core.git
synced 2026-09-24 23:41:48 -05:00
Align Fritz test data mock to real implementation (#167511)
This commit is contained in:
@@ -379,6 +379,8 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
||||
"""Return device Mac address."""
|
||||
if not self._unique_id:
|
||||
raise ClassSetupMissing
|
||||
# Unique ID is the serial number of the device
|
||||
# which is the MAC of the device without the colons
|
||||
return dr.format_mac(self._unique_id)
|
||||
|
||||
@property
|
||||
|
||||
@@ -48,10 +48,15 @@ MOCK_FIRMWARE_AVAILABLE = "7.50"
|
||||
MOCK_FIRMWARE_RELEASE_URL = (
|
||||
"http://download.avm.de/fritzbox/fritzbox-7530-ax/deutschland/fritz.os/info_de.txt"
|
||||
)
|
||||
MOCK_SERIAL_NUMBER = "fake_serial_number"
|
||||
|
||||
# The serial number needs to be in sync with the MAC address of the router
|
||||
# because the second is computed from the first one in the code.
|
||||
MOCK_SERIAL_NUMBER = "1CED6F123411"
|
||||
MOCK_MESH_MASTER_MAC = "1C:ED:6F:12:34:11"
|
||||
|
||||
MOCK_FIRMWARE_INFO = [True, "1.1.1", "some-release-url"]
|
||||
MOCK_MESH_SSID = "TestSSID"
|
||||
MOCK_MESH_MASTER_MAC = "1C:ED:6F:12:34:11"
|
||||
|
||||
MOCK_MESH_MASTER_WIFI1_MAC = "1C:ED:6F:12:34:12"
|
||||
MOCK_MESH_SLAVE_MAC = "1C:ED:6F:12:34:21"
|
||||
MOCK_MESH_SLAVE_WIFI1_MAC = "1C:ED:6F:12:34:22"
|
||||
@@ -59,7 +64,7 @@ MOCK_MESH_SLAVE_WIFI1_MAC = "1C:ED:6F:12:34:22"
|
||||
MOCK_FB_SERVICES: dict[str, dict[str, Any]] = {
|
||||
"DeviceInfo1": {
|
||||
"GetInfo": {
|
||||
"NewSerialNumber": MOCK_MESH_MASTER_MAC,
|
||||
"NewSerialNumber": MOCK_SERIAL_NUMBER,
|
||||
"NewName": "TheName",
|
||||
"NewManufacturerName": "AVM",
|
||||
"NewManufacturerOUI": "00040E",
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'is_connected',
|
||||
'unique_id': '1C:ED:6F:12:34:11-is_connected',
|
||||
'unique_id': '1CED6F123411-is_connected',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -83,7 +83,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'is_linked',
|
||||
'unique_id': '1C:ED:6F:12:34:11-is_linked',
|
||||
'unique_id': '1CED6F123411-is_linked',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'cleanup',
|
||||
'unique_id': '1C:ED:6F:12:34:11-cleanup',
|
||||
'unique_id': '1CED6F123411-cleanup',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -82,7 +82,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'firmware_update',
|
||||
'unique_id': '1C:ED:6F:12:34:11-firmware_update',
|
||||
'unique_id': '1CED6F123411-firmware_update',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -133,7 +133,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'reconnect',
|
||||
'unique_id': '1C:ED:6F:12:34:11-reconnect',
|
||||
'unique_id': '1CED6F123411-reconnect',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -184,7 +184,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-reboot',
|
||||
'unique_id': '1CED6F123411-reboot',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
'latest_firmware': None,
|
||||
'mesh_role': 'master',
|
||||
'model': 'FRITZ!Box 7530 AX',
|
||||
'unique_id': '1C:ED:XX:XX:34:11',
|
||||
'unique_id': '1CED6FXX:XX1',
|
||||
'update_available': False,
|
||||
'wan_link_properties': dict({
|
||||
'NewLayer1DownstreamMaxBitRate': 318557000,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'connection_uptime',
|
||||
'unique_id': '1C:ED:6F:12:34:11-connection_uptime',
|
||||
'unique_id': '1CED6F123411-connection_uptime',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -88,7 +88,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'cpu_temperature',
|
||||
'unique_id': '1C:ED:6F:12:34:11-cpu_temperature',
|
||||
'unique_id': '1CED6F123411-cpu_temperature',
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
})
|
||||
# ---
|
||||
@@ -146,7 +146,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'kb_s_received',
|
||||
'unique_id': '1C:ED:6F:12:34:11-kb_s_received',
|
||||
'unique_id': '1CED6F123411-kb_s_received',
|
||||
'unit_of_measurement': <UnitOfDataRate.KILOBYTES_PER_SECOND: 'kB/s'>,
|
||||
})
|
||||
# ---
|
||||
@@ -199,7 +199,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'external_ip',
|
||||
'unique_id': '1C:ED:6F:12:34:11-external_ip',
|
||||
'unique_id': '1CED6F123411-external_ip',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -249,7 +249,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'external_ipv6',
|
||||
'unique_id': '1C:ED:6F:12:34:11-external_ipv6',
|
||||
'unique_id': '1CED6F123411-external_ipv6',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -304,7 +304,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'gb_received',
|
||||
'unique_id': '1C:ED:6F:12:34:11-gb_received',
|
||||
'unique_id': '1CED6F123411-gb_received',
|
||||
'unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
|
||||
})
|
||||
# ---
|
||||
@@ -362,7 +362,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'gb_sent',
|
||||
'unique_id': '1C:ED:6F:12:34:11-gb_sent',
|
||||
'unique_id': '1CED6F123411-gb_sent',
|
||||
'unit_of_measurement': <UnitOfInformation.GIGABYTES: 'GB'>,
|
||||
})
|
||||
# ---
|
||||
@@ -415,7 +415,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'device_uptime',
|
||||
'unique_id': '1C:ED:6F:12:34:11-device_uptime',
|
||||
'unique_id': '1CED6F123411-device_uptime',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -466,7 +466,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'link_noise_margin_received',
|
||||
'unique_id': '1C:ED:6F:12:34:11-link_noise_margin_received',
|
||||
'unique_id': '1CED6F123411-link_noise_margin_received',
|
||||
'unit_of_measurement': 'dB',
|
||||
})
|
||||
# ---
|
||||
@@ -517,7 +517,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'link_attenuation_received',
|
||||
'unique_id': '1C:ED:6F:12:34:11-link_attenuation_received',
|
||||
'unique_id': '1CED6F123411-link_attenuation_received',
|
||||
'unit_of_measurement': 'dB',
|
||||
})
|
||||
# ---
|
||||
@@ -571,7 +571,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'link_kb_s_received',
|
||||
'unique_id': '1C:ED:6F:12:34:11-link_kb_s_received',
|
||||
'unique_id': '1CED6F123411-link_kb_s_received',
|
||||
'unit_of_measurement': <UnitOfDataRate.KILOBITS_PER_SECOND: 'kbit/s'>,
|
||||
})
|
||||
# ---
|
||||
@@ -623,7 +623,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'link_noise_margin_sent',
|
||||
'unique_id': '1C:ED:6F:12:34:11-link_noise_margin_sent',
|
||||
'unique_id': '1CED6F123411-link_noise_margin_sent',
|
||||
'unit_of_measurement': 'dB',
|
||||
})
|
||||
# ---
|
||||
@@ -674,7 +674,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'link_attenuation_sent',
|
||||
'unique_id': '1C:ED:6F:12:34:11-link_attenuation_sent',
|
||||
'unique_id': '1CED6F123411-link_attenuation_sent',
|
||||
'unit_of_measurement': 'dB',
|
||||
})
|
||||
# ---
|
||||
@@ -728,7 +728,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'link_kb_s_sent',
|
||||
'unique_id': '1C:ED:6F:12:34:11-link_kb_s_sent',
|
||||
'unique_id': '1CED6F123411-link_kb_s_sent',
|
||||
'unit_of_measurement': <UnitOfDataRate.KILOBITS_PER_SECOND: 'kbit/s'>,
|
||||
})
|
||||
# ---
|
||||
@@ -783,7 +783,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'max_kb_s_received',
|
||||
'unique_id': '1C:ED:6F:12:34:11-max_kb_s_received',
|
||||
'unique_id': '1CED6F123411-max_kb_s_received',
|
||||
'unit_of_measurement': <UnitOfDataRate.KILOBITS_PER_SECOND: 'kbit/s'>,
|
||||
})
|
||||
# ---
|
||||
@@ -838,7 +838,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'max_kb_s_sent',
|
||||
'unique_id': '1C:ED:6F:12:34:11-max_kb_s_sent',
|
||||
'unique_id': '1CED6F123411-max_kb_s_sent',
|
||||
'unit_of_measurement': <UnitOfDataRate.KILOBITS_PER_SECOND: 'kbit/s'>,
|
||||
})
|
||||
# ---
|
||||
@@ -895,7 +895,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'kb_s_sent',
|
||||
'unique_id': '1C:ED:6F:12:34:11-kb_s_sent',
|
||||
'unique_id': '1CED6F123411-kb_s_sent',
|
||||
'unit_of_measurement': <UnitOfDataRate.KILOBYTES_PER_SECOND: 'kB/s'>,
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-port_forward_test_port_mapping',
|
||||
'unique_id': '1CED6F123411-port_forward_test_port_mapping',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -83,7 +83,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-port_forward_test_port_mapping_81',
|
||||
'unique_id': '1CED6F123411-port_forward_test_port_mapping_81',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -134,7 +134,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'wi_fi_guest',
|
||||
'unique_id': '1C:ED:6F:12:34:11-wi_fi_guest',
|
||||
'unique_id': '1CED6F123411-wi_fi_guest',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -185,7 +185,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'wi_fi_main_2_4ghz',
|
||||
'unique_id': '1C:ED:6F:12:34:11-wi_fi_main_2_4ghz',
|
||||
'unique_id': '1CED6F123411-wi_fi_main_2_4ghz',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -286,7 +286,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-port_forward_test_port_mapping',
|
||||
'unique_id': '1CED6F123411-port_forward_test_port_mapping',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -337,7 +337,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-port_forward_test_port_mapping_81',
|
||||
'unique_id': '1CED6F123411-port_forward_test_port_mapping_81',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -388,7 +388,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'wi_fi_guest',
|
||||
'unique_id': '1C:ED:6F:12:34:11-wi_fi_guest',
|
||||
'unique_id': '1CED6F123411-wi_fi_guest',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -439,7 +439,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'wi_fi_main_2_4ghz',
|
||||
'unique_id': '1C:ED:6F:12:34:11-wi_fi_main_2_4ghz',
|
||||
'unique_id': '1CED6F123411-wi_fi_main_2_4ghz',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -540,7 +540,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-port_forward_test_port_mapping',
|
||||
'unique_id': '1CED6F123411-port_forward_test_port_mapping',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -591,7 +591,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-port_forward_test_port_mapping_81',
|
||||
'unique_id': '1CED6F123411-port_forward_test_port_mapping_81',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -642,7 +642,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'wi_fi_guest',
|
||||
'unique_id': '1C:ED:6F:12:34:11-wi_fi_guest',
|
||||
'unique_id': '1CED6F123411-wi_fi_guest',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -693,7 +693,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'wi_fi_main_2_4ghz',
|
||||
'unique_id': '1C:ED:6F:12:34:11-wi_fi_main_2_4ghz',
|
||||
'unique_id': '1CED6F123411-wi_fi_main_2_4ghz',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -794,7 +794,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-call_deflection_0',
|
||||
'unique_id': '1CED6F123411-call_deflection_0',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -851,7 +851,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-port_forward_test_port_mapping',
|
||||
'unique_id': '1CED6F123411-port_forward_test_port_mapping',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -902,7 +902,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-port_forward_test_port_mapping_81',
|
||||
'unique_id': '1CED6F123411-port_forward_test_port_mapping_81',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -953,7 +953,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'wi_fi_guest',
|
||||
'unique_id': '1C:ED:6F:12:34:11-wi_fi_guest',
|
||||
'unique_id': '1CED6F123411-wi_fi_guest',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -1004,7 +1004,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'wi_fi_main_2_4ghz',
|
||||
'unique_id': '1C:ED:6F:12:34:11-wi_fi_main_2_4ghz',
|
||||
'unique_id': '1CED6F123411-wi_fi_main_2_4ghz',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': <UpdateEntityFeature: 1>,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-update',
|
||||
'unique_id': '1CED6F123411-update',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -94,7 +94,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': <UpdateEntityFeature: 1>,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-update',
|
||||
'unique_id': '1CED6F123411-update',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -156,7 +156,7 @@
|
||||
'suggested_object_id': None,
|
||||
'supported_features': <UpdateEntityFeature: 1>,
|
||||
'translation_key': None,
|
||||
'unique_id': '1C:ED:6F:12:34:11-update',
|
||||
'unique_id': '1CED6F123411-update',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -40,7 +40,7 @@ from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .conftest import FritzConnectionMock, FritzServiceMock
|
||||
from .const import MOCK_MESH_MASTER_MAC, MOCK_STATUS_DEVICE_INFO_DATA, MOCK_USER_DATA
|
||||
from .const import MOCK_SERIAL_NUMBER, MOCK_STATUS_DEVICE_INFO_DATA, MOCK_USER_DATA
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@@ -195,7 +195,7 @@ async def test_no_software_version(
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_MESH_MASTER_MAC)}
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)}
|
||||
)
|
||||
assert device
|
||||
assert device.sw_version == "string_version_not_number"
|
||||
|
||||
@@ -17,7 +17,12 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.entity_registry import EntityRegistry
|
||||
from homeassistant.util import slugify
|
||||
|
||||
from .const import MOCK_FB_SERVICES, MOCK_MESH_MASTER_MAC, MOCK_USER_DATA
|
||||
from .const import (
|
||||
MOCK_FB_SERVICES,
|
||||
MOCK_MESH_MASTER_MAC,
|
||||
MOCK_SERIAL_NUMBER,
|
||||
MOCK_USER_DATA,
|
||||
)
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
from tests.typing import ClientSessionGenerator
|
||||
@@ -108,7 +113,7 @@ async def test_image_entity(
|
||||
}
|
||||
|
||||
assert (state := entity_registry.async_get("image.mock_title_guestwifi"))
|
||||
assert state.unique_id == "1C:ED:6F:12:34:11-guest_wifi_qr_code"
|
||||
assert state.unique_id == f"{MOCK_SERIAL_NUMBER}-guest_wifi_qr_code"
|
||||
|
||||
# test image download
|
||||
client = await hass_client()
|
||||
@@ -224,8 +229,8 @@ async def test_migrate_to_new_unique_id(
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
old_unique_id = slugify(f"{MOCK_MESH_MASTER_MAC}-GuestWifi-qr-code")
|
||||
new_unique_id = f"{MOCK_MESH_MASTER_MAC}-guest_wifi_qr_code"
|
||||
old_unique_id = slugify(f"{MOCK_SERIAL_NUMBER}-GuestWifi-qr-code")
|
||||
new_unique_id = f"{MOCK_SERIAL_NUMBER}-guest_wifi_qr_code"
|
||||
|
||||
entity_registry.async_get_or_create(
|
||||
suggested_object_id="mock_title_mywifi",
|
||||
@@ -238,7 +243,7 @@ async def test_migrate_to_new_unique_id(
|
||||
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=entry.entry_id,
|
||||
identifiers={(DOMAIN, mock_unique_id)},
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)},
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, MOCK_MESH_MASTER_MAC)},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -19,7 +19,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .const import MOCK_MESH_MASTER_MAC, MOCK_USER_DATA
|
||||
from .const import MOCK_SERIAL_NUMBER, MOCK_USER_DATA
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@@ -50,7 +50,7 @@ async def test_service_set_guest_wifi_password(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_MESH_MASTER_MAC)}
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)}
|
||||
)
|
||||
assert device
|
||||
with patch(
|
||||
@@ -78,7 +78,7 @@ async def test_service_set_guest_wifi_password_unknown_parameter(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_MESH_MASTER_MAC)}
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)}
|
||||
)
|
||||
assert device
|
||||
|
||||
@@ -109,7 +109,7 @@ async def test_service_set_guest_wifi_password_service_not_supported(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_MESH_MASTER_MAC)}
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)}
|
||||
)
|
||||
assert device
|
||||
|
||||
@@ -161,7 +161,7 @@ async def test_service_dial(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_MESH_MASTER_MAC)}
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)}
|
||||
)
|
||||
assert device
|
||||
with patch(
|
||||
@@ -193,7 +193,7 @@ async def test_service_dial_unknown_parameter(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_MESH_MASTER_MAC)}
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)}
|
||||
)
|
||||
assert device
|
||||
|
||||
@@ -226,7 +226,7 @@ async def test_service_dial_wrong_parameter(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_MESH_MASTER_MAC)}
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)}
|
||||
)
|
||||
assert device
|
||||
|
||||
@@ -276,7 +276,7 @@ async def test_service_dial_service_not_supported(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_MESH_MASTER_MAC)}
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)}
|
||||
)
|
||||
assert device
|
||||
|
||||
@@ -309,7 +309,7 @@ async def test_service_dial_failed(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_MESH_MASTER_MAC)}
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)}
|
||||
)
|
||||
assert device
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ from .const import (
|
||||
MOCK_FB_SERVICES,
|
||||
MOCK_HOST_ATTRIBUTES_DATA,
|
||||
MOCK_MESH_MASTER_MAC,
|
||||
MOCK_SERIAL_NUMBER,
|
||||
MOCK_USER_DATA,
|
||||
)
|
||||
|
||||
@@ -515,8 +516,8 @@ async def test_migrate_to_new_unique_id(
|
||||
for old_description, new_identifier in zip(
|
||||
old_descriptions, new_identifiers, strict=True
|
||||
):
|
||||
old_unique_id = f"{MOCK_MESH_MASTER_MAC}-{slugify(old_description)}"
|
||||
new_unique_id = f"{MOCK_MESH_MASTER_MAC}-wi_fi_{new_identifier}"
|
||||
old_unique_id = f"{MOCK_SERIAL_NUMBER}-{slugify(old_description)}"
|
||||
new_unique_id = f"{MOCK_SERIAL_NUMBER}-wi_fi_{new_identifier}"
|
||||
old_unique_ids.append(old_unique_id)
|
||||
new_unique_ids.append(new_unique_id)
|
||||
entity_ids.append(f"switch.fritz_{slugify(old_unique_id)}")
|
||||
@@ -531,7 +532,7 @@ async def test_migrate_to_new_unique_id(
|
||||
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=entry.entry_id,
|
||||
identifiers={(DOMAIN, MOCK_UNIQUE_ID)},
|
||||
identifiers={(DOMAIN, MOCK_SERIAL_NUMBER)},
|
||||
connections={
|
||||
(dr.CONNECTION_NETWORK_MAC, MOCK_MESH_MASTER_MAC),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user