mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Cleanup unused import in proximity config flow (#124681)
* Cleanup unused import in proximity config flow * Cleanup tests
This commit is contained in:
parent
68cdf8877c
commit
dece7e0f9c
@ -117,12 +117,6 @@ class ProximityConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
data_schema=self._user_form_schema(user_input),
|
data_schema=self._user_form_schema(user_input),
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_import(
|
|
||||||
self, user_input: dict[str, Any] | None = None
|
|
||||||
) -> ConfigFlowResult:
|
|
||||||
"""Import a yaml config entry."""
|
|
||||||
return await self.async_step_user(user_input)
|
|
||||||
|
|
||||||
|
|
||||||
class ProximityOptionsFlow(OptionsFlow):
|
class ProximityOptionsFlow(OptionsFlow):
|
||||||
"""Handle a option flow."""
|
"""Handle a option flow."""
|
||||||
|
@ -10,8 +10,8 @@ from homeassistant.components.proximity.const import (
|
|||||||
CONF_TRACKED_ENTITIES,
|
CONF_TRACKED_ENTITIES,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
from homeassistant.config_entries import SOURCE_USER
|
||||||
from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT, CONF_ZONE
|
from homeassistant.const import CONF_ZONE
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.data_entry_flow import FlowResultType
|
from homeassistant.data_entry_flow import FlowResultType
|
||||||
|
|
||||||
@ -120,42 +120,6 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async def test_import_flow(hass: HomeAssistant) -> None:
|
|
||||||
"""Test import of yaml configuration."""
|
|
||||||
with patch(
|
|
||||||
"homeassistant.components.proximity.async_setup_entry", return_value=True
|
|
||||||
) as mock_setup_entry:
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
|
||||||
DOMAIN,
|
|
||||||
context={"source": SOURCE_IMPORT},
|
|
||||||
data={
|
|
||||||
CONF_NAME: "home",
|
|
||||||
CONF_ZONE: "zone.home",
|
|
||||||
CONF_TRACKED_ENTITIES: ["device_tracker.test1"],
|
|
||||||
CONF_IGNORED_ZONES: ["zone.work"],
|
|
||||||
CONF_TOLERANCE: 10,
|
|
||||||
CONF_UNIT_OF_MEASUREMENT: "km",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
|
||||||
assert result["data"] == {
|
|
||||||
CONF_NAME: "home",
|
|
||||||
CONF_ZONE: "zone.home",
|
|
||||||
CONF_TRACKED_ENTITIES: ["device_tracker.test1"],
|
|
||||||
CONF_IGNORED_ZONES: ["zone.work"],
|
|
||||||
CONF_TOLERANCE: 10,
|
|
||||||
CONF_UNIT_OF_MEASUREMENT: "km",
|
|
||||||
}
|
|
||||||
|
|
||||||
zone = hass.states.get("zone.home")
|
|
||||||
assert result["title"] == zone.name
|
|
||||||
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
assert mock_setup_entry.called
|
|
||||||
|
|
||||||
|
|
||||||
async def test_abort_duplicated_entry(hass: HomeAssistant) -> None:
|
async def test_abort_duplicated_entry(hass: HomeAssistant) -> None:
|
||||||
"""Test if we abort on duplicate user input data."""
|
"""Test if we abort on duplicate user input data."""
|
||||||
DATA = {
|
DATA = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user