mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Remove trailing slash from base_url and added ability to generate webhook path. (#20295)
This commit is contained in:
committed by
Fabian Affolter
parent
c36c708068
commit
bb21cb6c89
@@ -80,6 +80,11 @@ class TestApiConfig(unittest.TestCase):
|
||||
api_config = http.ApiConfig('http://example.com', use_ssl=True)
|
||||
assert api_config.base_url == 'http://example.com:8123'
|
||||
|
||||
def test_api_base_url_removes_trailing_slash(hass):
|
||||
"""Test a trialing slash is removed when setting the API URL."""
|
||||
api_config = http.ApiConfig('http://example.com/')
|
||||
assert api_config.base_url == 'http://example.com:8123'
|
||||
|
||||
|
||||
async def test_api_base_url_with_domain(hass):
|
||||
"""Test setting API URL."""
|
||||
@@ -124,6 +129,17 @@ async def test_api_no_base_url(hass):
|
||||
assert hass.config.api.base_url == 'http://127.0.0.1:8123'
|
||||
|
||||
|
||||
async def test_api_base_url_removes_trailing_slash(hass):
|
||||
"""Test setting api url."""
|
||||
result = await async_setup_component(hass, 'http', {
|
||||
'http': {
|
||||
'base_url': 'https://example.com/'
|
||||
}
|
||||
})
|
||||
assert result
|
||||
assert hass.config.api.base_url == 'https://example.com'
|
||||
|
||||
|
||||
async def test_not_log_password(hass, aiohttp_client, caplog, legacy_auth):
|
||||
"""Test access with password doesn't get logged."""
|
||||
assert await async_setup_component(hass, 'api', {
|
||||
|
||||
Reference in New Issue
Block a user