mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Migrate zwave_js to use async_update_entry to alter config entries (#110376)
This commit is contained in:
parent
a51d3b4286
commit
3b409b07e3
@ -1705,7 +1705,7 @@ async def test_install_addon_failure(
|
|||||||
async def test_options_manual(hass: HomeAssistant, client, integration) -> None:
|
async def test_options_manual(hass: HomeAssistant, client, integration) -> None:
|
||||||
"""Test manual settings in options flow."""
|
"""Test manual settings in options flow."""
|
||||||
entry = integration
|
entry = integration
|
||||||
entry.unique_id = "1234"
|
hass.config_entries.async_update_entry(entry, unique_id="1234")
|
||||||
|
|
||||||
assert client.connect.call_count == 1
|
assert client.connect.call_count == 1
|
||||||
assert client.disconnect.call_count == 0
|
assert client.disconnect.call_count == 0
|
||||||
@ -1733,7 +1733,7 @@ async def test_options_manual_different_device(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test options flow manual step connecting to different device."""
|
"""Test options flow manual step connecting to different device."""
|
||||||
entry = integration
|
entry = integration
|
||||||
entry.unique_id = 5678
|
hass.config_entries.async_update_entry(entry, unique_id="5678")
|
||||||
|
|
||||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||||
|
|
||||||
@ -1754,7 +1754,7 @@ async def test_options_not_addon(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test options flow and opting out of add-on on Supervisor."""
|
"""Test options flow and opting out of add-on on Supervisor."""
|
||||||
entry = integration
|
entry = integration
|
||||||
entry.unique_id = "1234"
|
hass.config_entries.async_update_entry(entry, unique_id="1234")
|
||||||
|
|
||||||
assert client.connect.call_count == 1
|
assert client.connect.call_count == 1
|
||||||
assert client.disconnect.call_count == 0
|
assert client.disconnect.call_count == 0
|
||||||
@ -1861,9 +1861,8 @@ async def test_options_addon_running(
|
|||||||
"""Test options flow and add-on already running on Supervisor."""
|
"""Test options flow and add-on already running on Supervisor."""
|
||||||
addon_options.update(old_addon_options)
|
addon_options.update(old_addon_options)
|
||||||
entry = integration
|
entry = integration
|
||||||
entry.unique_id = "1234"
|
|
||||||
data = {**entry.data, **entry_data}
|
data = {**entry.data, **entry_data}
|
||||||
hass.config_entries.async_update_entry(entry, data=data)
|
hass.config_entries.async_update_entry(entry, data=data, unique_id="1234")
|
||||||
|
|
||||||
assert entry.data["url"] == "ws://test.org"
|
assert entry.data["url"] == "ws://test.org"
|
||||||
|
|
||||||
@ -1971,9 +1970,8 @@ async def test_options_addon_running_no_changes(
|
|||||||
"""Test options flow without changes, and add-on already running on Supervisor."""
|
"""Test options flow without changes, and add-on already running on Supervisor."""
|
||||||
addon_options.update(old_addon_options)
|
addon_options.update(old_addon_options)
|
||||||
entry = integration
|
entry = integration
|
||||||
entry.unique_id = "1234"
|
|
||||||
data = {**entry.data, **entry_data}
|
data = {**entry.data, **entry_data}
|
||||||
hass.config_entries.async_update_entry(entry, data=data)
|
hass.config_entries.async_update_entry(entry, data=data, unique_id="1234")
|
||||||
|
|
||||||
assert entry.data["url"] == "ws://test.org"
|
assert entry.data["url"] == "ws://test.org"
|
||||||
|
|
||||||
@ -2115,9 +2113,8 @@ async def test_options_different_device(
|
|||||||
"""Test options flow and configuring a different device."""
|
"""Test options flow and configuring a different device."""
|
||||||
addon_options.update(old_addon_options)
|
addon_options.update(old_addon_options)
|
||||||
entry = integration
|
entry = integration
|
||||||
entry.unique_id = "1234"
|
|
||||||
data = {**entry.data, **entry_data}
|
data = {**entry.data, **entry_data}
|
||||||
hass.config_entries.async_update_entry(entry, data=data)
|
hass.config_entries.async_update_entry(entry, data=data, unique_id="1234")
|
||||||
|
|
||||||
assert entry.data["url"] == "ws://test.org"
|
assert entry.data["url"] == "ws://test.org"
|
||||||
|
|
||||||
@ -2274,9 +2271,8 @@ async def test_options_addon_restart_failed(
|
|||||||
"""Test options flow and add-on restart failure."""
|
"""Test options flow and add-on restart failure."""
|
||||||
addon_options.update(old_addon_options)
|
addon_options.update(old_addon_options)
|
||||||
entry = integration
|
entry = integration
|
||||||
entry.unique_id = "1234"
|
|
||||||
data = {**entry.data, **entry_data}
|
data = {**entry.data, **entry_data}
|
||||||
hass.config_entries.async_update_entry(entry, data=data)
|
hass.config_entries.async_update_entry(entry, data=data, unique_id="1234")
|
||||||
|
|
||||||
assert entry.data["url"] == "ws://test.org"
|
assert entry.data["url"] == "ws://test.org"
|
||||||
|
|
||||||
@ -2402,9 +2398,8 @@ async def test_options_addon_running_server_info_failure(
|
|||||||
"""Test options flow and add-on already running with server info failure."""
|
"""Test options flow and add-on already running with server info failure."""
|
||||||
addon_options.update(old_addon_options)
|
addon_options.update(old_addon_options)
|
||||||
entry = integration
|
entry = integration
|
||||||
entry.unique_id = "1234"
|
|
||||||
data = {**entry.data, **entry_data}
|
data = {**entry.data, **entry_data}
|
||||||
hass.config_entries.async_update_entry(entry, data=data)
|
hass.config_entries.async_update_entry(entry, data=data, unique_id="1234")
|
||||||
|
|
||||||
assert entry.data["url"] == "ws://test.org"
|
assert entry.data["url"] == "ws://test.org"
|
||||||
|
|
||||||
@ -2511,9 +2506,8 @@ async def test_options_addon_not_installed(
|
|||||||
"""Test options flow and add-on not installed on Supervisor."""
|
"""Test options flow and add-on not installed on Supervisor."""
|
||||||
addon_options.update(old_addon_options)
|
addon_options.update(old_addon_options)
|
||||||
entry = integration
|
entry = integration
|
||||||
entry.unique_id = "1234"
|
|
||||||
data = {**entry.data, **entry_data}
|
data = {**entry.data, **entry_data}
|
||||||
hass.config_entries.async_update_entry(entry, data=data)
|
hass.config_entries.async_update_entry(entry, data=data, unique_id="1234")
|
||||||
|
|
||||||
assert entry.data["url"] == "ws://test.org"
|
assert entry.data["url"] == "ws://test.org"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user