Cleanup unused import in zwave_js config flow (#124716)

pull/124723/head
epenet 2024-08-27 18:41:27 +02:00 committed by GitHub
parent 1936aeccb9
commit 0dc1eb8757
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 110 deletions

View File

@ -366,18 +366,6 @@ class ZWaveJSConfigFlow(BaseZwaveJSFlow, ConfigFlow, domain=DOMAIN):
"""Return the options flow."""
return OptionsFlowHandler(config_entry)
async def async_step_import(self, import_data: dict[str, Any]) -> ConfigFlowResult:
"""Handle imported data.
This step will be used when importing data
during Z-Wave to Z-Wave JS migration.
"""
# Note that the data comes from the zwave integration.
# So we don't use our constants here.
self.s0_legacy_key = import_data.get("network_key")
self.usb_path = import_data.get("usb_path")
return await self.async_step_user()
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:

View File

@ -2726,104 +2726,6 @@ async def test_options_addon_not_installed(
assert client.disconnect.call_count == 1
@pytest.mark.parametrize("discovery_info", [{"config": ADDON_DISCOVERY_INFO}])
async def test_import_addon_installed(
hass: HomeAssistant,
supervisor,
addon_installed,
addon_options,
set_addon_options,
start_addon,
get_addon_discovery_info,
serial_port,
) -> None:
"""Test import step while add-on already installed on Supervisor."""
serial_port.device = "/test/imported"
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_IMPORT},
data={"usb_path": "/test/imported", "network_key": "imported123"},
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "on_supervisor"
result = await hass.config_entries.flow.async_configure(
result["flow_id"], {"use_addon": True}
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "configure_addon"
# the default input should be the imported data
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": "",
"lr_s2_access_control_key": "",
"lr_s2_authenticated_key": "",
}
result = await hass.config_entries.flow.async_configure(
result["flow_id"], default_input
)
assert set_addon_options.call_args == call(
hass,
"core_zwave_js",
{
"options": {
"device": "/test/imported",
"s0_legacy_key": "imported123",
"s2_access_control_key": "",
"s2_authenticated_key": "",
"s2_unauthenticated_key": "",
"lr_s2_access_control_key": "",
"lr_s2_authenticated_key": "",
}
},
)
assert result["type"] is FlowResultType.SHOW_PROGRESS
assert result["step_id"] == "start_addon"
with (
patch(
"homeassistant.components.zwave_js.async_setup", return_value=True
) as mock_setup,
patch(
"homeassistant.components.zwave_js.async_setup_entry",
return_value=True,
) as mock_setup_entry,
):
await hass.async_block_till_done()
result = await hass.config_entries.flow.async_configure(result["flow_id"])
await hass.async_block_till_done()
assert start_addon.call_args == call(hass, "core_zwave_js")
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == TITLE
assert result["data"] == {
"url": "ws://host1:3001",
"usb_path": "/test/imported",
"s0_legacy_key": "imported123",
"s2_access_control_key": "",
"s2_authenticated_key": "",
"s2_unauthenticated_key": "",
"lr_s2_access_control_key": "",
"lr_s2_authenticated_key": "",
"use_addon": True,
"integration_created_addon": False,
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1
async def test_zeroconf(hass: HomeAssistant) -> None:
"""Test zeroconf discovery."""