Fix setup and tear down issues for mqtt discovery and config flow tests (#120333)

* Fix setup and tear down issues for mqtt discovery and config flow tests

* Use async callback
This commit is contained in:
Jan Bouwhuis 2024-06-24 16:20:44 +02:00 committed by GitHub
parent 2776b28bb7
commit 85720f9e02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 85 additions and 49 deletions

View file

@ -1104,7 +1104,6 @@ async def test_skipping_advanced_options(
)
async def test_step_reauth(
hass: HomeAssistant,
mqtt_mock_entry: MqttMockHAClientGenerator,
mqtt_client_mock: MqttMockPahoClient,
mock_try_connection: MagicMock,
mock_reload_after_entry_update: MagicMock,
@ -1115,12 +1114,9 @@ async def test_step_reauth(
"""Test that the reauth step works."""
# Prepare the config entry
config_entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
hass.config_entries.async_update_entry(
config_entry,
data=test_input,
)
await mqtt_mock_entry()
config_entry = MockConfigEntry(domain=mqtt.DOMAIN, data=test_input)
config_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(config_entry.entry_id)
# Start reauth flow
config_entry.async_start_reauth(hass)