Adjust unique_id in SamsungTV tests (#143959)

This commit is contained in:
epenet 2025-04-30 15:25:50 +02:00 committed by GitHub
parent 9b1c6b07f5
commit 800f403643
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 21 additions and 12 deletions

View File

@ -25,7 +25,10 @@ async def async_wait_config_entry_reload(hass: HomeAssistant) -> None:
async def setup_samsungtv_entry(hass: HomeAssistant, data: ConfigType) -> ConfigEntry:
"""Set up mock Samsung TV from config entry data."""
entry = MockConfigEntry(
domain=DOMAIN, data=data, entry_id="123456", unique_id="any"
domain=DOMAIN,
data=data,
entry_id="123456",
unique_id="be9554b9-c9fb-41f4-8920-22da015376a4",
)
entry.add_to_hass(hass)

View File

@ -28,7 +28,9 @@ async def test_get_triggers(
"""Test we get the expected triggers."""
await setup_samsungtv_entry(hass, MOCK_ENTRYDATA_ENCRYPTED_WS)
device = device_registry.async_get_device(identifiers={(DOMAIN, "any")})
device = device_registry.async_get_device(
identifiers={(DOMAIN, "be9554b9-c9fb-41f4-8920-22da015376a4")}
)
turn_on_trigger = {
"platform": "device",
@ -54,7 +56,9 @@ async def test_if_fires_on_turn_on_request(
await setup_samsungtv_entry(hass, MOCK_ENTRYDATA_ENCRYPTED_WS)
entity_id = "media_player.fake"
device = device_registry.async_get_device(identifiers={(DOMAIN, "any")})
device = device_registry.async_get_device(
identifiers={(DOMAIN, "be9554b9-c9fb-41f4-8920-22da015376a4")}
)
assert await async_setup_component(
hass,

View File

@ -53,7 +53,7 @@ async def test_entry_diagnostics(
"source": "user",
"subentries": [],
"title": "Mock Title",
"unique_id": "any",
"unique_id": "be9554b9-c9fb-41f4-8920-22da015376a4",
"version": 2,
},
"device_info": SAMPLE_DEVICE_INFO_WIFI,
@ -94,7 +94,7 @@ async def test_entry_diagnostics_encrypted(
"source": "user",
"subentries": [],
"title": "Mock Title",
"unique_id": "any",
"unique_id": "be9554b9-c9fb-41f4-8920-22da015376a4",
"version": 2,
},
"device_info": SAMPLE_DEVICE_INFO_UE48JU6400,
@ -134,7 +134,7 @@ async def test_entry_diagnostics_encrypte_offline(
"source": "user",
"subentries": [],
"title": "Mock Title",
"unique_id": "any",
"unique_id": "be9554b9-c9fb-41f4-8920-22da015376a4",
"version": 2,
},
"device_info": None,

View File

@ -235,7 +235,7 @@ async def test_cleanup_mac(
domain=DOMAIN,
data=MOCK_ENTRY_WS_WITH_MAC,
entry_id="123456",
unique_id="any",
unique_id="be9554b9-c9fb-41f4-8920-22da015376a4",
version=2,
minor_version=1,
)
@ -248,7 +248,7 @@ async def test_cleanup_mac(
(dr.CONNECTION_NETWORK_MAC, "none"),
(dr.CONNECTION_NETWORK_MAC, "aa:bb:cc:dd:ee:ff"),
},
identifiers={("samsungtv", "any")},
identifiers={("samsungtv", "be9554b9-c9fb-41f4-8920-22da015376a4")},
model="82GXARRS",
name="fake",
)

View File

@ -1005,7 +1005,7 @@ async def test_turn_on_wol(hass: HomeAssistant) -> None:
entry = MockConfigEntry(
domain=DOMAIN,
data=MOCK_ENTRY_WS_WITH_MAC,
unique_id="any",
unique_id="be9554b9-c9fb-41f4-8920-22da015376a4",
)
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)

View File

@ -39,7 +39,7 @@ async def test_unique_id(
await setup_samsungtv_entry(hass, MOCK_ENTRYDATA_ENCRYPTED_WS)
main = entity_registry.async_get(ENTITY_ID)
assert main.unique_id == "any"
assert main.unique_id == "be9554b9-c9fb-41f4-8920-22da015376a4"
@pytest.mark.usefixtures("remoteencws", "rest_api")
@ -104,7 +104,7 @@ async def test_turn_on_wol(hass: HomeAssistant) -> None:
entry = MockConfigEntry(
domain=DOMAIN,
data=MOCK_ENTRY_WS_WITH_MAC,
unique_id="any",
unique_id="be9554b9-c9fb-41f4-8920-22da015376a4",
)
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)

View File

@ -30,7 +30,9 @@ async def test_turn_on_trigger_device_id(
entity_id = f"{entity_domain}.fake"
device = device_registry.async_get_device(identifiers={(DOMAIN, "any")})
device = device_registry.async_get_device(
identifiers={(DOMAIN, "be9554b9-c9fb-41f4-8920-22da015376a4")}
)
assert device, repr(device_registry.devices)
assert await async_setup_component(