Clean up MQTT platform entry setup at discovery (#72371)

* Setup MQTT discovery with entry setup

* Wait for entry setup in test

* flake
This commit is contained in:
Jan Bouwhuis 2022-06-13 13:38:53 +02:00 committed by GitHub
parent f846cd033f
commit 48e3d68b53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 44 deletions

View file

@ -1780,13 +1780,12 @@ async def test_setup_entry_with_config_override(
# mqtt present in yaml config
assert await async_setup_component(hass, mqtt.DOMAIN, {})
await hass.async_block_till_done()
await mqtt_mock_entry_with_yaml_config()
# User sets up a config entry
entry = MockConfigEntry(domain=mqtt.DOMAIN, data={mqtt.CONF_BROKER: "test-broker"})
entry.add_to_hass(hass)
with patch("homeassistant.components.mqtt.PLATFORMS", []):
assert await hass.config_entries.async_setup(entry.entry_id)
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
# Discover a device to verify the entry was setup correctly
async_fire_mqtt_message(hass, "homeassistant/sensor/bla/config", data)