mirror of
https://github.com/home-assistant/core.git
synced 2025-08-06 06:05:10 +02:00
update tests
This commit is contained in:
@@ -155,10 +155,10 @@ class DlnaDmrEntity(MediaPlayerEntity):
|
||||
self.browse_unfiltered = browse_unfiltered
|
||||
self._device_lock = asyncio.Lock()
|
||||
self._background_setup_task: asyncio.Task[None] | None = None
|
||||
self._updated_registry: bool = False
|
||||
# Device info will be updated when the device is connected
|
||||
self._attr_device_info = dr.DeviceInfo(
|
||||
connections={(dr.CONNECTION_UPNP, self.udn)},
|
||||
default_name=name,
|
||||
)
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
@@ -374,9 +374,10 @@ class DlnaDmrEntity(MediaPlayerEntity):
|
||||
if not self.registry_entry or not self.registry_entry.config_entry_id:
|
||||
return # No config registry entry to link to
|
||||
|
||||
if self.registry_entry.device_id and not set_mac:
|
||||
if self.registry_entry.device_id and not set_mac and self._updated_registry:
|
||||
return # No new information
|
||||
|
||||
self._updated_registry = True
|
||||
connections = set()
|
||||
# Connections based on the root device's UDN, and the DMR embedded
|
||||
# device's UDN. They may be the same, if the DMR is the root device.
|
||||
|
@@ -1349,7 +1349,9 @@ async def test_unavailable_device(
|
||||
connections={(CONNECTION_UPNP, MOCK_DEVICE_UDN)},
|
||||
identifiers=set(),
|
||||
)
|
||||
assert device is None
|
||||
assert device is not None
|
||||
assert device.name is None
|
||||
assert device.manufacturer is None
|
||||
|
||||
# Unload config entry to clean up
|
||||
assert await hass.config_entries.async_remove(config_entry_mock.entry_id) == {
|
||||
@@ -1379,7 +1381,6 @@ async def test_become_available(
|
||||
# Cause connection attempts to fail before adding entity
|
||||
domain_data_mock.upnp_factory.async_create_device.side_effect = UpnpConnectionError
|
||||
mock_entity_id = await setup_mock_component(hass, config_entry_mock)
|
||||
await async_update_entity(hass, mock_entity_id)
|
||||
mock_state = hass.states.get(mock_entity_id)
|
||||
assert mock_state is not None
|
||||
assert mock_state.state == ha_const.STATE_UNAVAILABLE
|
||||
@@ -1390,7 +1391,7 @@ async def test_become_available(
|
||||
connections={(CONNECTION_UPNP, MOCK_DEVICE_UDN)},
|
||||
identifiers=set(),
|
||||
)
|
||||
assert device is None
|
||||
assert device is not None
|
||||
|
||||
# Mock device is now available.
|
||||
domain_data_mock.upnp_factory.async_create_device.side_effect = None
|
||||
|
Reference in New Issue
Block a user