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

@ -1,10 +1,9 @@
"""Test the webhook component."""
import pytest
from homeassistant.config import async_process_ha_core_config
from homeassistant.setup import async_setup_component
from tests.async_mock import Mock
@pytest.fixture
def mock_client(hass, hass_client):
@ -37,7 +36,9 @@ async def test_unregistering_webhook(hass, mock_client):
async def test_generate_webhook_url(hass):
"""Test we generate a webhook url correctly."""
hass.config.api = Mock(base_url="https://example.com")
await async_process_ha_core_config(
hass, {"external_url": "https://example.com"},
)
url = hass.components.webhook.async_generate_url("some_id")
assert url == "https://example.com/api/webhook/some_id"