1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add support for reload_on_update to _abort_if_unique_id_configured (#38638)

* Add support for reload_on_update to _abort_if_unique_id_configured

async_update_entry now avoids firing update listeners and writing
the storage if there are no actual changes.

* Actually add the tests

* collapse branch

* Update homeassistant/config_entries.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

* handle entries that lack the ability to reload

* reduce

* adjust konnected tests

* update axis tests

* fix blocking

* more mocking

* config flow tests outside of test_config_flow

* reduce

* volumio

* Update homeassistant/config_entries.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* set reload_on_update=False for integrations that implement self._abort_if_unique_id_configured(updates= and a reload listen

* get rid of copy

* revert test change

Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
J. Nick Koston
2020-08-08 13:23:56 -05:00
committed by GitHub
parent 1cb161017e
commit 74c23c3e96
9 changed files with 272 additions and 82 deletions

View File

@@ -135,19 +135,23 @@ async def test_update_address(hass):
gateway = await setup_deconz_integration(hass)
assert gateway.api.host == "1.2.3.4"
await hass.config_entries.flow.async_init(
deconz.config_flow.DOMAIN,
data={
ssdp.ATTR_SSDP_LOCATION: "http://2.3.4.5:80/",
ssdp.ATTR_UPNP_MANUFACTURER_URL: deconz.config_flow.DECONZ_MANUFACTURERURL,
ssdp.ATTR_UPNP_SERIAL: BRIDGEID,
ssdp.ATTR_UPNP_UDN: "uuid:456DEF",
},
context={"source": "ssdp"},
)
await hass.async_block_till_done()
with patch(
"homeassistant.components.deconz.async_setup_entry", return_value=True,
) as mock_setup_entry:
await hass.config_entries.flow.async_init(
deconz.config_flow.DOMAIN,
data={
ssdp.ATTR_SSDP_LOCATION: "http://2.3.4.5:80/",
ssdp.ATTR_UPNP_MANUFACTURER_URL: deconz.config_flow.DECONZ_MANUFACTURERURL,
ssdp.ATTR_UPNP_SERIAL: BRIDGEID,
ssdp.ATTR_UPNP_UDN: "uuid:456DEF",
},
context={"source": "ssdp"},
)
await hass.async_block_till_done()
assert gateway.api.host == "2.3.4.5"
assert len(mock_setup_entry.mock_calls) == 1
async def test_reset_after_successful_setup(hass):