diff --git a/tests/components/tplink/test_init.py b/tests/components/tplink/test_init.py index e5a973b67b4c..d1a314943efb 100644 --- a/tests/components/tplink/test_init.py +++ b/tests/components/tplink/test_init.py @@ -545,7 +545,12 @@ async def test_unlink_devices( } assert device_entries[0].identifiers == set(test_identifiers) - with patch("homeassistant.components.tplink.CONF_CONFIG_ENTRY_MINOR_VERSION", 3): + with ( + patch("homeassistant.components.tplink.CONF_CONFIG_ENTRY_MINOR_VERSION", 3), + _patch_discovery(), + _patch_single_discovery(), + _patch_connect(), + ): await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() @@ -596,6 +601,8 @@ async def test_move_credentials_hash( patch("homeassistant.components.tplink.Device.connect", new=_connect), patch("homeassistant.components.tplink.PLATFORMS", []), patch("homeassistant.components.tplink.CONF_CONFIG_ENTRY_MINOR_VERSION", 4), + _patch_discovery(), + _patch_single_discovery(), ): await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() @@ -640,6 +647,8 @@ async def test_move_credentials_hash_auth_error( ), patch("homeassistant.components.tplink.PLATFORMS", []), patch("homeassistant.components.tplink.CONF_CONFIG_ENTRY_MINOR_VERSION", 4), + _patch_discovery(), + _patch_single_discovery(), ): entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) @@ -682,6 +691,8 @@ async def test_move_credentials_hash_other_error( ), patch("homeassistant.components.tplink.PLATFORMS", []), patch("homeassistant.components.tplink.CONF_CONFIG_ENTRY_MINOR_VERSION", 4), + _patch_discovery(), + _patch_single_discovery(), ): entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) @@ -717,6 +728,8 @@ async def test_credentials_hash( with ( patch("homeassistant.components.tplink.PLATFORMS", []), patch("homeassistant.components.tplink.Device.connect", new=_connect), + _patch_discovery(), + _patch_single_discovery(), ): entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) @@ -753,6 +766,8 @@ async def test_credentials_hash_auth_error( "homeassistant.components.tplink.Device.connect", side_effect=AuthenticationError, ) as connect_mock, + _patch_discovery(), + _patch_single_discovery(), ): entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) @@ -782,6 +797,7 @@ async def test_credentials_hash_auth_error( async def test_migrate_remove_device_config( hass: HomeAssistant, mock_connect: AsyncMock, + mock_discovery: AsyncMock, caplog: pytest.LogCaptureFixture, device_config: DeviceConfig, expected_entry_data: dict[str, Any],