1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Do not activate Met.no without setting a Home coordinates (#48741)

This commit is contained in:
Franck Nijhof
2021-04-07 09:39:39 +02:00
committed by GitHub
parent 5f8fcca5ad
commit 6ec8e17e7b
7 changed files with 104 additions and 9 deletions

View File

@@ -4,6 +4,7 @@ from unittest.mock import patch
import pytest
from homeassistant.components.met.const import DOMAIN, HOME_LOCATION_NAME
from homeassistant.config import async_process_ha_core_config
from homeassistant.const import CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE
from tests.common import MockConfigEntry
@@ -106,6 +107,25 @@ async def test_onboarding_step(hass):
assert result["data"] == {"track_home": True}
@pytest.mark.parametrize("latitude,longitude", [(52.3731339, 4.8903147), (0.0, 0.0)])
async def test_onboarding_step_abort_no_home(hass, latitude, longitude):
"""Test entry not created when default step fails."""
await async_process_ha_core_config(
hass,
{"latitude": latitude, "longitude": longitude},
)
assert hass.config.latitude == latitude
assert hass.config.longitude == longitude
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "onboarding"}, data={}
)
assert result["type"] == "abort"
assert result["reason"] == "no_home"
async def test_import_step(hass):
"""Test initializing via import step."""
test_data = {