async def test_options_form_cannot_connect(hass: HomeAssistant, mock_config_entry_v2: MockConfigEntry) -> None:
    """Test we handle cannot connect error."""
    mock_config_entry_v2.add_to_hass(hass)
    result = await hass.config_entries.options.async_init(mock_config_entry_v2.entry_id)

    assert result["type"] == FlowResultType.FORM
    assert result["errors"] is None

    with (
        patch(
            "custom_components.homematicip_local.config_flow._async_validate_config_and_get_system_information",
            side_effect=NoConnectionException("no host"),
        ),
        patch(
            "custom_components.homematicip_local.async_setup_entry",
            return_value=True,
        ),
    ):
        result2 = await hass.config_entries.options.async_configure(
            result["flow_id"],
            {},
        )
        await hass.async_block_till_done()

        assert result2["type"] == FlowResultType.FORM
        assert result2["handler"] == const.CONFIG_ENTRY_ID
        assert result2["step_id"] == "interface"

        next(flow for flow in hass.config_entries.options.async_progress() if flow["flow_id"] == result["flow_id"])

        result3 = await hass.config_entries.options.async_configure(
            result["flow_id"],
            {},
        )
        await hass.async_block_till_done()

    assert result3["type"] == FlowResultType.FORM
    assert result3["errors"] == {"base": "cannot_connect"}
Test we handle cannot connect error.
tests/test_config_flow.py