mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Standardize import step variable name in geonetnz_volcano (#124699)
This commit is contained in:
parent
1add00a68d
commit
b085ac9296
@ -47,9 +47,9 @@ class GeonetnzVolcanoFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
step_id="user", data_schema=data_schema, errors=errors or {}
|
||||
)
|
||||
|
||||
async def async_step_import(self, import_config):
|
||||
async def async_step_import(self, import_data: dict[str, Any]) -> ConfigFlowResult:
|
||||
"""Import a config entry from configuration.yaml."""
|
||||
return await self.async_step_user(import_config)
|
||||
return await self.async_step_user(import_data)
|
||||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
|
@ -3,7 +3,8 @@
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.geonetnz_volcano import config_flow
|
||||
from homeassistant.components.geonetnz_volcano import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
||||
from homeassistant.const import (
|
||||
CONF_LATITUDE,
|
||||
CONF_LONGITUDE,
|
||||
@ -20,19 +21,18 @@ async def test_duplicate_error(hass: HomeAssistant, config_entry) -> None:
|
||||
conf = {CONF_LATITUDE: -41.2, CONF_LONGITUDE: 174.7, CONF_RADIUS: 25}
|
||||
|
||||
config_entry.add_to_hass(hass)
|
||||
flow = config_flow.GeonetnzVolcanoFlowHandler()
|
||||
flow.hass = hass
|
||||
|
||||
result = await flow.async_step_user(user_input=conf)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=conf
|
||||
)
|
||||
assert result["errors"] == {"base": "already_configured"}
|
||||
|
||||
|
||||
async def test_show_form(hass: HomeAssistant) -> None:
|
||||
"""Test that the form is served with no input."""
|
||||
flow = config_flow.GeonetnzVolcanoFlowHandler()
|
||||
flow.hass = hass
|
||||
|
||||
result = await flow.async_step_user(user_input=None)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=None
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
@ -48,9 +48,6 @@ async def test_step_import(hass: HomeAssistant) -> None:
|
||||
CONF_SCAN_INTERVAL: timedelta(minutes=4),
|
||||
}
|
||||
|
||||
flow = config_flow.GeonetnzVolcanoFlowHandler()
|
||||
flow.hass = hass
|
||||
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.geonetnz_volcano.async_setup_entry",
|
||||
@ -60,7 +57,9 @@ async def test_step_import(hass: HomeAssistant) -> None:
|
||||
"homeassistant.components.geonetnz_volcano.async_setup", return_value=True
|
||||
),
|
||||
):
|
||||
result = await flow.async_step_import(import_config=conf)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=conf
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
@ -78,9 +77,6 @@ async def test_step_user(hass: HomeAssistant) -> None:
|
||||
hass.config.longitude = 174.7
|
||||
conf = {CONF_RADIUS: 25}
|
||||
|
||||
flow = config_flow.GeonetnzVolcanoFlowHandler()
|
||||
flow.hass = hass
|
||||
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.geonetnz_volcano.async_setup_entry",
|
||||
@ -90,7 +86,9 @@ async def test_step_user(hass: HomeAssistant) -> None:
|
||||
"homeassistant.components.geonetnz_volcano.async_setup", return_value=True
|
||||
),
|
||||
):
|
||||
result = await flow.async_step_user(user_input=conf)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=conf
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
|
Loading…
x
Reference in New Issue
Block a user