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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 308 additions and 73 deletions

View file

@ -5,6 +5,7 @@ from homeassistant import data_entry_flow
from homeassistant.components import traccar, zone
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER_DOMAIN
from homeassistant.components.traccar import DOMAIN, TRACKER_UPDATE
from homeassistant.config import async_process_ha_core_config
from homeassistant.const import (
HTTP_OK,
HTTP_UNPROCESSABLE_ENTITY,
@ -14,7 +15,7 @@ from homeassistant.const import (
from homeassistant.helpers.dispatcher import DATA_DISPATCHER
from homeassistant.setup import async_setup_component
from tests.async_mock import Mock, patch
from tests.async_mock import patch
HOME_LATITUDE = 37.239622
HOME_LONGITUDE = -115.815811
@ -23,7 +24,6 @@ HOME_LONGITUDE = -115.815811
@pytest.fixture(autouse=True)
def mock_dev_track(mock_device_tracker_conf):
"""Mock device tracker config loading."""
pass
@pytest.fixture(name="client")
@ -60,7 +60,9 @@ async def setup_zones(loop, hass):
@pytest.fixture(name="webhook_id")
async def webhook_id_fixture(hass, client):
"""Initialize the Traccar component and get the webhook_id."""
hass.config.api = Mock(base_url="http://example.com")
await async_process_ha_core_config(
hass, {"external_url": "http://example.com"},
)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}
)