Remove deprecated YAML configuration from Sensibo (#69028)
This commit is contained in:
parent
666cbebd28
commit
b45399b164
4 changed files with 4 additions and 106 deletions
|
@ -60,70 +60,6 @@ async def test_form(hass: HomeAssistant) -> None:
|
|||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_import_flow_success(hass: HomeAssistant) -> None:
|
||||
"""Test a successful import of yaml."""
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.sensibo.util.SensiboClient.async_get_devices",
|
||||
return_value={"result": [{"id": "xyzxyz"}, {"id": "abcabc"}]},
|
||||
), patch(
|
||||
"homeassistant.components.sensibo.util.SensiboClient.async_get_me",
|
||||
return_value={"result": {"username": "username"}},
|
||||
), patch(
|
||||
"homeassistant.components.sensibo.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
result2 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_IMPORT},
|
||||
data={
|
||||
CONF_API_KEY: "1234567890",
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2["title"] == "Sensibo"
|
||||
assert result2["data"] == {
|
||||
"api_key": "1234567890",
|
||||
}
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_import_flow_already_exist(hass: HomeAssistant) -> None:
|
||||
"""Test import of yaml already exist."""
|
||||
|
||||
MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data={
|
||||
CONF_API_KEY: "1234567890",
|
||||
},
|
||||
unique_id="username",
|
||||
).add_to_hass(hass)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.sensibo.async_setup_entry",
|
||||
return_value=True,
|
||||
), patch(
|
||||
"homeassistant.components.sensibo.util.SensiboClient.async_get_devices",
|
||||
return_value={"result": [{"id": "xyzxyz"}, {"id": "abcabc"}]},
|
||||
), patch(
|
||||
"homeassistant.components.sensibo.util.SensiboClient.async_get_me",
|
||||
return_value={"result": {"username": "username"}},
|
||||
):
|
||||
result3 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_IMPORT},
|
||||
data={
|
||||
CONF_API_KEY: "1234567890",
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result3["type"] == RESULT_TYPE_ABORT
|
||||
assert result3["reason"] == "already_configured"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"error_message, p_error",
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue