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

Detect use of deprecated base_url (#35353)

* Detect use of deprecated base_url

* Update get_url helper

* Update core migration

* Migrate all tests
This commit is contained in:
Franck Nijhof
2020-05-08 17:52:32 +02:00
committed by GitHub
parent 1be41b9de8
commit e56dd8ed50
21 changed files with 308 additions and 73 deletions

View File

@@ -6,12 +6,11 @@ import pytest
from homeassistant import data_entry_flow
from homeassistant.components import mailgun, webhook
from homeassistant.config import async_process_ha_core_config
from homeassistant.const import CONF_API_KEY, CONF_DOMAIN
from homeassistant.core import callback
from homeassistant.setup import async_setup_component
from tests.async_mock import Mock
API_KEY = "abc123"
@@ -31,7 +30,9 @@ async def webhook_id_with_api_key(hass):
{mailgun.DOMAIN: {CONF_API_KEY: API_KEY, CONF_DOMAIN: "example.com"}},
)
hass.config.api = Mock(base_url="http://example.com")
await async_process_ha_core_config(
hass, {"internal_url": "http://example.local:8123"},
)
result = await hass.config_entries.flow.async_init(
"mailgun", context={"source": "user"}
)
@@ -48,7 +49,9 @@ async def webhook_id_without_api_key(hass):
"""Initialize the Mailgun component and get the webhook_id w/o API key."""
await async_setup_component(hass, mailgun.DOMAIN, {})
hass.config.api = Mock(base_url="http://example.com")
await async_process_ha_core_config(
hass, {"internal_url": "http://example.local:8123"},
)
result = await hass.config_entries.flow.async_init(
"mailgun", context={"source": "user"}
)