Allow async_setup changes to config entry data be taken into a… (#34166)

* Allow async_setup changes to config entry data be taken into account

* Fix tests

* Limit scope try…finally

* Update tests/test_config_entries.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Fix import

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Paulus SchoutsenandMartin Hjelmare authored and GitHub committed 2020-04-14 18:46:41 -07:00
1 parent 0db1fcca0f
commit 0b90ebf91e
10 files changed
+176 -33

No files matched your search

+6 -2
View File
@@ -15,7 +15,9 @@ async def test_config_with_sensor_passed_to_config_entry(hass):
CONF_SCAN_INTERVAL: 600,
}
with patch.object(hass, "config_entries") as mock_config_entries, patch.object(
with patch.object(
hass.config_entries.flow, "async_init"
) as mock_config_entries, patch.object(
luftdaten, "configured_sensors", return_value=[]
):
assert await async_setup_component(hass, DOMAIN, conf) is True
@@ -27,7 +29,9 @@ async def test_config_already_registered_not_passed_to_config_entry(hass):
"""Test that an already registered sensor does not initiate an import."""
conf = {CONF_SENSOR_ID: "12345abcde"}
with patch.object(hass, "config_entries") as mock_config_entries, patch.object(
with patch.object(
hass.config_entries.flow, "async_init"
) as mock_config_entries, patch.object(
luftdaten, "configured_sensors", return_value=["12345abcde"]
):
assert await async_setup_component(hass, DOMAIN, conf) is True