Fix duplicate config entry additions in tests (#107984)

zha and plex still add the same config entry multiple times
but they are going to need seperate PRs as they have more
complex logic
pull/108002/head
J. Nick Koston 2024-01-13 16:01:18 -10:00 committed by GitHub
parent 3c1e2e17a0
commit 9c82df4b98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 4 additions and 7 deletions

View File

@ -26,7 +26,6 @@ async def test_wrong_login(
) -> None:
"""Test for setup failure if connection to Anova is missing."""
entry = create_entry(hass)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
assert entry.state is ConfigEntryState.SETUP_ERROR

View File

@ -351,8 +351,7 @@ async def test_restored_state(
],
)
august_entry = await _create_august_with_devices(hass, [lock_one])
august_entry.add_to_hass(hass)
await _create_august_with_devices(hass, [lock_one])
await hass.async_block_till_done()

View File

@ -40,7 +40,6 @@ async def init_integration(
"""Set up the Efergy integration in Home Assistant."""
entry = create_entry(hass, token=token)
await mock_responses(hass, aioclient_mock, token=token, error=error)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()

View File

@ -571,7 +571,6 @@ async def test_scan_calendar_error(
config_entry,
) -> None:
"""Test that the calendar update handles a server error."""
config_entry.add_to_hass(hass)
mock_calendars_list({}, exc=ClientError())
assert await component_setup()

View File

@ -162,7 +162,6 @@ async def test_sensors_available_after_restart(
manufacturer="Kraken.com",
entry_type=dr.DeviceEntryType.SERVICE,
)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)

View File

@ -98,7 +98,6 @@ async def test_restoring_clients(hass: HomeAssistant) -> None:
)
with RuckusAjaxApiPatchContext(active_clients={}):
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()

View File

@ -826,6 +826,9 @@ async def test_device_types(
# nightlight as a setting of the main entity
if nightlight_mode_properties is not None:
mocked_bulb.last_properties["active_mode"] = True
config_entry = MockConfigEntry(
domain=DOMAIN, data={**CONFIG_ENTRY_DATA, CONF_NIGHTLIGHT_SWITCH: False}
)
config_entry.add_to_hass(hass)
await _async_setup(config_entry)
state = hass.states.get(entity_id)