Solax: remove deprecated YAML import (#69003)
This commit is contained in:
parent
88c9233d50
commit
d5f4e512e9
3 changed files with 2 additions and 89 deletions
|
@ -90,42 +90,3 @@ async def test_form_unknown_error(hass):
|
|||
|
||||
assert entry_result["type"] == "form"
|
||||
assert entry_result["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
async def test_import_success(hass):
|
||||
"""Test import success."""
|
||||
conf = {CONF_IP_ADDRESS: "192.168.1.87", CONF_PORT: 80}
|
||||
with patch(
|
||||
"homeassistant.components.solax.config_flow.real_time_api",
|
||||
return_value=__mock_real_time_api_success(),
|
||||
), patch("solax.RealTimeAPI.get_data", return_value=__mock_get_data()), patch(
|
||||
"homeassistant.components.solax.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
entry_result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=conf
|
||||
)
|
||||
|
||||
assert entry_result["type"] == "create_entry"
|
||||
assert entry_result["title"] == "ABCDEFGHIJ"
|
||||
assert entry_result["data"] == {
|
||||
CONF_IP_ADDRESS: "192.168.1.87",
|
||||
CONF_PORT: 80,
|
||||
CONF_PASSWORD: "",
|
||||
}
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_import_error(hass):
|
||||
"""Test import success."""
|
||||
conf = {CONF_IP_ADDRESS: "192.168.1.87", CONF_PORT: 80}
|
||||
with patch(
|
||||
"homeassistant.components.solax.config_flow.real_time_api",
|
||||
side_effect=ConnectionError,
|
||||
):
|
||||
entry_result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=conf
|
||||
)
|
||||
|
||||
assert entry_result["type"] == "form"
|
||||
assert entry_result["errors"] == {"base": "cannot_connect"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue