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
This commit is contained in:
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: ) -> None:
"""Test for setup failure if connection to Anova is missing.""" """Test for setup failure if connection to Anova is missing."""
entry = create_entry(hass) entry = create_entry(hass)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id) await hass.config_entries.async_setup(entry.entry_id)
assert entry.state is ConfigEntryState.SETUP_ERROR 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]) await _create_august_with_devices(hass, [lock_one])
august_entry.add_to_hass(hass)
await hass.async_block_till_done() await hass.async_block_till_done()

View file

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

View file

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

View file

@ -162,7 +162,6 @@ async def test_sensors_available_after_restart(
manufacturer="Kraken.com", manufacturer="Kraken.com",
entry_type=dr.DeviceEntryType.SERVICE, entry_type=dr.DeviceEntryType.SERVICE,
) )
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id) 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={}): with RuckusAjaxApiPatchContext(active_clients={}):
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id) await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done() 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 # nightlight as a setting of the main entity
if nightlight_mode_properties is not None: if nightlight_mode_properties is not None:
mocked_bulb.last_properties["active_mode"] = True 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) config_entry.add_to_hass(hass)
await _async_setup(config_entry) await _async_setup(config_entry)
state = hass.states.get(entity_id) state = hass.states.get(entity_id)