From 014d29297dac9dda45a50ec9eb2fa63a735538ac Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 6 Feb 2024 16:09:08 -0600 Subject: [PATCH] revert test changes --- .../components/dlna_dmr/media_player.py | 4 --- tests/components/dlna_dmr/test_init.py | 5 ---- .../components/dlna_dmr/test_media_player.py | 27 +++++-------------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/homeassistant/components/dlna_dmr/media_player.py b/homeassistant/components/dlna_dmr/media_player.py index 99e615ee2be..2e078188436 100644 --- a/homeassistant/components/dlna_dmr/media_player.py +++ b/homeassistant/components/dlna_dmr/media_player.py @@ -156,10 +156,6 @@ class DlnaDmrEntity(MediaPlayerEntity): 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)}, - ) async def async_added_to_hass(self) -> None: """Handle addition.""" diff --git a/tests/components/dlna_dmr/test_init.py b/tests/components/dlna_dmr/test_init.py index 38160f117b4..f1c3151fb28 100644 --- a/tests/components/dlna_dmr/test_init.py +++ b/tests/components/dlna_dmr/test_init.py @@ -6,7 +6,6 @@ from homeassistant.components import media_player from homeassistant.components.dlna_dmr.const import DOMAIN as DLNA_DOMAIN from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er -from homeassistant.helpers.entity_component import async_update_entity from homeassistant.setup import async_setup_component from tests.common import MockConfigEntry @@ -32,10 +31,6 @@ async def test_resource_lifecycle( ) assert len(entries) == 1 entity_id = entries[0].entity_id - - await async_update_entity(hass, entity_id) - await hass.async_block_till_done() - mock_state = hass.states.get(entity_id) assert mock_state is not None assert mock_state.state == media_player.STATE_IDLE diff --git a/tests/components/dlna_dmr/test_media_player.py b/tests/components/dlna_dmr/test_media_player.py index dfce8f42fd0..51128b161fb 100644 --- a/tests/components/dlna_dmr/test_media_player.py +++ b/tests/components/dlna_dmr/test_media_player.py @@ -216,9 +216,6 @@ async def test_setup_entry_no_options( """ config_entry_mock.options = MappingProxyType({}) mock_entity_id = await setup_mock_component(hass, config_entry_mock) - await async_update_entity(hass, mock_entity_id) - await hass.async_block_till_done() - mock_state = hass.states.get(mock_entity_id) assert mock_state is not None @@ -288,8 +285,6 @@ async def test_setup_entry_with_options( } ) mock_entity_id = await setup_mock_component(hass, config_entry_mock) - await async_update_entity(hass, mock_entity_id) - await hass.async_block_till_done() mock_state = hass.states.get(mock_entity_id) assert mock_state is not None @@ -348,9 +343,8 @@ async def test_setup_entry_mac_address( dmr_device_mock: Mock, ) -> None: """Entry with a MAC address will set up and set the device registry connection.""" - mock_entity_id = await setup_mock_component(hass, config_entry_mock) - await async_update_entity(hass, mock_entity_id) - await hass.async_block_till_done() + await setup_mock_component(hass, config_entry_mock) + # Check the device registry connections for MAC address dev_reg = async_get_dr(hass) device = dev_reg.async_get_device( @@ -369,9 +363,8 @@ async def test_setup_entry_no_mac_address( dmr_device_mock: Mock, ) -> None: """Test setting up an entry without a MAC address will succeed.""" - mock_entity_id = await setup_mock_component(hass, config_entry_mock_no_mac) - await async_update_entity(hass, mock_entity_id) - await hass.async_block_till_done() + await setup_mock_component(hass, config_entry_mock_no_mac) + # Check the device registry connections does not include the MAC address dev_reg = async_get_dr(hass) device = dev_reg.async_get_device( @@ -389,8 +382,6 @@ async def test_event_subscribe_failure( dmr_device_mock.async_subscribe_services.side_effect = UpnpError mock_entity_id = await setup_mock_component(hass, config_entry_mock) - await async_update_entity(hass, mock_entity_id) - await hass.async_block_till_done() mock_state = hass.states.get(mock_entity_id) assert mock_state is not None @@ -421,8 +412,6 @@ async def test_event_subscribe_rejected( dmr_device_mock.async_subscribe_services.side_effect = UpnpResponseError(status=501) mock_entity_id = await setup_mock_component(hass, config_entry_mock) - await async_update_entity(hass, mock_entity_id) - await hass.async_block_till_done() mock_state = hass.states.get(mock_entity_id) assert mock_state is not None @@ -443,8 +432,6 @@ async def test_available_device( ) -> None: """Test a DlnaDmrEntity with a connected DmrDevice.""" # Check hass device information is filled in - await async_update_entity(hass, mock_entity_id) - await hass.async_block_till_done() dev_reg = async_get_dr(hass) device = dev_reg.async_get_device( connections={(CONNECTION_UPNP, MOCK_DEVICE_UDN)}, @@ -1349,9 +1336,7 @@ async def test_unavailable_device( connections={(CONNECTION_UPNP, MOCK_DEVICE_UDN)}, identifiers=set(), ) - assert device is not None - assert device.name is None - assert device.manufacturer is None + assert device is None # Unload config entry to clean up assert await hass.config_entries.async_remove(config_entry_mock.entry_id) == { @@ -1391,7 +1376,7 @@ async def test_become_available( connections={(CONNECTION_UPNP, MOCK_DEVICE_UDN)}, identifiers=set(), ) - assert device is not None + assert device is None # Mock device is now available. domain_data_mock.upnp_factory.async_create_device.side_effect = None