diff --git a/tests/components/geonetnz_quakes/test_config_flow.py b/tests/components/geonetnz_quakes/test_config_flow.py index 61729776f9c3..f469c3c16370 100644 --- a/tests/components/geonetnz_quakes/test_config_flow.py +++ b/tests/components/geonetnz_quakes/test_config_flow.py @@ -22,12 +22,17 @@ from homeassistant.data_entry_flow import FlowResultType async def test_duplicate_error(hass: HomeAssistant, config_entry) -> None: """Test that errors are shown when duplicates are added.""" - conf = {CONF_LATITUDE: -41.2, CONF_LONGITUDE: 174.7, CONF_RADIUS: 25} + hass.config.latitude = -41.2 + hass.config.longitude = 174.7 + conf = {CONF_RADIUS: 25} config_entry.add_to_hass(hass) result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf + DOMAIN, context={"source": config_entries.SOURCE_USER} ) + assert result["type"] is FlowResultType.FORM + + result = await hass.config_entries.flow.async_configure(result["flow_id"], conf) assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" @@ -94,15 +99,18 @@ async def test_step_user(hass: HomeAssistant) -> None: ), ): result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": config_entries.SOURCE_USER}, data=conf + DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["type"] is FlowResultType.CREATE_ENTRY - assert result["title"] == "-41.2, 174.7" - assert result["data"] == { - CONF_LATITUDE: -41.2, - CONF_LONGITUDE: 174.7, - CONF_RADIUS: 25, - CONF_MMI: 4, - CONF_SCAN_INTERVAL: 300.0, - CONF_MINIMUM_MAGNITUDE: 0.0, - } + assert result["type"] is FlowResultType.FORM + + result = await hass.config_entries.flow.async_configure(result["flow_id"], conf) + assert result["type"] is FlowResultType.CREATE_ENTRY + assert result["title"] == "-41.2, 174.7" + assert result["data"] == { + CONF_LATITUDE: -41.2, + CONF_LONGITUDE: 174.7, + CONF_RADIUS: 25, + CONF_MMI: 4, + CONF_SCAN_INTERVAL: 300.0, + CONF_MINIMUM_MAGNITUDE: 0.0, + }