mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Fix zwave_js config flow import step (#56808)
This commit is contained in:
parent
b9d81c3a7e
commit
12b2076351
@ -321,8 +321,10 @@ class ConfigFlow(BaseZwaveJSFlow, config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
This step will be used when importing data
|
This step will be used when importing data
|
||||||
during Z-Wave to Z-Wave JS migration.
|
during Z-Wave to Z-Wave JS migration.
|
||||||
"""
|
"""
|
||||||
self.network_key = data.get(CONF_NETWORK_KEY)
|
# Note that the data comes from the zwave integration.
|
||||||
self.usb_path = data.get(CONF_USB_PATH)
|
# So we don't use our constants here.
|
||||||
|
self.s0_legacy_key = data.get("network_key")
|
||||||
|
self.usb_path = data.get("usb_path")
|
||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
|
@ -2422,6 +2422,14 @@ async def test_import_addon_installed(
|
|||||||
# the default input should be the imported data
|
# the default input should be the imported data
|
||||||
default_input = result["data_schema"]({})
|
default_input = result["data_schema"]({})
|
||||||
|
|
||||||
|
assert default_input == {
|
||||||
|
"usb_path": "/test/imported",
|
||||||
|
"s0_legacy_key": "imported123",
|
||||||
|
"s2_access_control_key": "",
|
||||||
|
"s2_authenticated_key": "",
|
||||||
|
"s2_unauthenticated_key": "",
|
||||||
|
}
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"], default_input
|
result["flow_id"], default_input
|
||||||
)
|
)
|
||||||
@ -2429,7 +2437,15 @@ async def test_import_addon_installed(
|
|||||||
assert set_addon_options.call_args == call(
|
assert set_addon_options.call_args == call(
|
||||||
hass,
|
hass,
|
||||||
"core_zwave_js",
|
"core_zwave_js",
|
||||||
{"options": {"device": "/test/imported", "network_key": "imported123"}},
|
{
|
||||||
|
"options": {
|
||||||
|
"device": "/test/imported",
|
||||||
|
"s0_legacy_key": "imported123",
|
||||||
|
"s2_access_control_key": "",
|
||||||
|
"s2_authenticated_key": "",
|
||||||
|
"s2_unauthenticated_key": "",
|
||||||
|
}
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == "progress"
|
assert result["type"] == "progress"
|
||||||
@ -2452,7 +2468,10 @@ async def test_import_addon_installed(
|
|||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
"url": "ws://host1:3001",
|
"url": "ws://host1:3001",
|
||||||
"usb_path": "/test/imported",
|
"usb_path": "/test/imported",
|
||||||
"network_key": "imported123",
|
"s0_legacy_key": "imported123",
|
||||||
|
"s2_access_control_key": "",
|
||||||
|
"s2_authenticated_key": "",
|
||||||
|
"s2_unauthenticated_key": "",
|
||||||
"use_addon": True,
|
"use_addon": True,
|
||||||
"integration_created_addon": False,
|
"integration_created_addon": False,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user