mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 04:50:05 +00:00
Upgrade black to 20.8b1 (#39287)
This commit is contained in:
@@ -26,7 +26,8 @@ async def test_get_url_internal(hass: HomeAssistant):
|
||||
|
||||
# Test with internal URL: http://example.local:8123
|
||||
await async_process_ha_core_config(
|
||||
hass, {"internal_url": "http://example.local:8123"},
|
||||
hass,
|
||||
{"internal_url": "http://example.local:8123"},
|
||||
)
|
||||
|
||||
assert hass.config.internal_url == "http://example.local:8123"
|
||||
@@ -66,7 +67,8 @@ async def test_get_url_internal(hass: HomeAssistant):
|
||||
|
||||
# Test with internal URL: https://example.local:8123
|
||||
await async_process_ha_core_config(
|
||||
hass, {"internal_url": "https://example.local:8123"},
|
||||
hass,
|
||||
{"internal_url": "https://example.local:8123"},
|
||||
)
|
||||
|
||||
assert hass.config.internal_url == "https://example.local:8123"
|
||||
@@ -79,7 +81,8 @@ async def test_get_url_internal(hass: HomeAssistant):
|
||||
|
||||
# Test with internal URL: http://example.local:80/
|
||||
await async_process_ha_core_config(
|
||||
hass, {"internal_url": "http://example.local:80/"},
|
||||
hass,
|
||||
{"internal_url": "http://example.local:80/"},
|
||||
)
|
||||
|
||||
assert hass.config.internal_url == "http://example.local:80/"
|
||||
@@ -92,7 +95,8 @@ async def test_get_url_internal(hass: HomeAssistant):
|
||||
|
||||
# Test with internal URL: https://example.local:443
|
||||
await async_process_ha_core_config(
|
||||
hass, {"internal_url": "https://example.local:443"},
|
||||
hass,
|
||||
{"internal_url": "https://example.local:443"},
|
||||
)
|
||||
|
||||
assert hass.config.internal_url == "https://example.local:443"
|
||||
@@ -105,7 +109,8 @@ async def test_get_url_internal(hass: HomeAssistant):
|
||||
|
||||
# Test with internal URL: https://192.168.0.1
|
||||
await async_process_ha_core_config(
|
||||
hass, {"internal_url": "https://192.168.0.1"},
|
||||
hass,
|
||||
{"internal_url": "https://192.168.0.1"},
|
||||
)
|
||||
|
||||
assert hass.config.internal_url == "https://192.168.0.1"
|
||||
@@ -118,7 +123,8 @@ async def test_get_url_internal(hass: HomeAssistant):
|
||||
|
||||
# Test with internal URL: http://192.168.0.1:8123
|
||||
await async_process_ha_core_config(
|
||||
hass, {"internal_url": "http://192.168.0.1:8123"},
|
||||
hass,
|
||||
{"internal_url": "http://192.168.0.1:8123"},
|
||||
)
|
||||
|
||||
assert hass.config.internal_url == "http://192.168.0.1:8123"
|
||||
@@ -224,7 +230,8 @@ async def test_get_url_external(hass: HomeAssistant):
|
||||
|
||||
# Test with external URL: http://example.com:8123
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "http://example.com:8123"},
|
||||
hass,
|
||||
{"external_url": "http://example.com:8123"},
|
||||
)
|
||||
|
||||
assert hass.config.external_url == "http://example.com:8123"
|
||||
@@ -266,7 +273,8 @@ async def test_get_url_external(hass: HomeAssistant):
|
||||
|
||||
# Test with external URL: http://example.com:80/
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "http://example.com:80/"},
|
||||
hass,
|
||||
{"external_url": "http://example.com:80/"},
|
||||
)
|
||||
|
||||
assert hass.config.external_url == "http://example.com:80/"
|
||||
@@ -281,7 +289,8 @@ async def test_get_url_external(hass: HomeAssistant):
|
||||
|
||||
# Test with external url: https://example.com:443/
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "https://example.com:443/"},
|
||||
hass,
|
||||
{"external_url": "https://example.com:443/"},
|
||||
)
|
||||
assert hass.config.external_url == "https://example.com:443/"
|
||||
assert _get_external_url(hass) == "https://example.com"
|
||||
@@ -293,7 +302,8 @@ async def test_get_url_external(hass: HomeAssistant):
|
||||
|
||||
# Test with external URL: https://example.com:80
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "https://example.com:80"},
|
||||
hass,
|
||||
{"external_url": "https://example.com:80"},
|
||||
)
|
||||
assert hass.config.external_url == "https://example.com:80"
|
||||
assert _get_external_url(hass) == "https://example.com:80"
|
||||
@@ -307,7 +317,8 @@ async def test_get_url_external(hass: HomeAssistant):
|
||||
|
||||
# Test with external URL: https://192.168.0.1
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "https://192.168.0.1"},
|
||||
hass,
|
||||
{"external_url": "https://192.168.0.1"},
|
||||
)
|
||||
assert hass.config.external_url == "https://192.168.0.1"
|
||||
assert _get_external_url(hass) == "https://192.168.0.1"
|
||||
@@ -381,7 +392,8 @@ async def test_get_external_url_cloud_fallback(hass: HomeAssistant):
|
||||
|
||||
# Test with external URL: http://1.1.1.1:8123
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "http://1.1.1.1:8123"},
|
||||
hass,
|
||||
{"external_url": "http://1.1.1.1:8123"},
|
||||
)
|
||||
|
||||
assert hass.config.external_url == "http://1.1.1.1:8123"
|
||||
@@ -406,7 +418,8 @@ async def test_get_external_url_cloud_fallback(hass: HomeAssistant):
|
||||
|
||||
# Test with external URL: https://example.com
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "https://example.com"},
|
||||
hass,
|
||||
{"external_url": "https://example.com"},
|
||||
)
|
||||
|
||||
assert hass.config.external_url == "https://example.com"
|
||||
@@ -453,7 +466,8 @@ async def test_get_url(hass: HomeAssistant):
|
||||
# Test only external
|
||||
hass.config.api = None
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "https://example.com"},
|
||||
hass,
|
||||
{"external_url": "https://example.com"},
|
||||
)
|
||||
assert hass.config.external_url == "https://example.com"
|
||||
assert hass.config.internal_url is None
|
||||
@@ -703,7 +717,8 @@ async def test_get_internal_url_with_base_url_fallback(hass: HomeAssistant):
|
||||
|
||||
# Add internal URL
|
||||
await async_process_ha_core_config(
|
||||
hass, {"internal_url": "https://internal.local"},
|
||||
hass,
|
||||
{"internal_url": "https://internal.local"},
|
||||
)
|
||||
assert _get_internal_url(hass) == "https://internal.local"
|
||||
assert _get_internal_url(hass, allow_ip=False) == "https://internal.local"
|
||||
@@ -714,7 +729,8 @@ async def test_get_internal_url_with_base_url_fallback(hass: HomeAssistant):
|
||||
|
||||
# Add internal URL, mixed results
|
||||
await async_process_ha_core_config(
|
||||
hass, {"internal_url": "http://internal.local:8123"},
|
||||
hass,
|
||||
{"internal_url": "http://internal.local:8123"},
|
||||
)
|
||||
assert _get_internal_url(hass) == "http://internal.local:8123"
|
||||
assert _get_internal_url(hass, allow_ip=False) == "http://internal.local:8123"
|
||||
@@ -725,7 +741,8 @@ async def test_get_internal_url_with_base_url_fallback(hass: HomeAssistant):
|
||||
|
||||
# Add internal URL set to an IP
|
||||
await async_process_ha_core_config(
|
||||
hass, {"internal_url": "http://10.10.10.10:8123"},
|
||||
hass,
|
||||
{"internal_url": "http://10.10.10.10:8123"},
|
||||
)
|
||||
assert _get_internal_url(hass) == "http://10.10.10.10:8123"
|
||||
assert _get_internal_url(hass, allow_ip=False) == "https://example.local"
|
||||
@@ -752,7 +769,8 @@ async def test_get_external_url_with_base_url_fallback(hass: HomeAssistant):
|
||||
|
||||
# Add external URL
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "https://external.example.com"},
|
||||
hass,
|
||||
{"external_url": "https://external.example.com"},
|
||||
)
|
||||
assert _get_external_url(hass) == "https://external.example.com"
|
||||
assert _get_external_url(hass, allow_ip=False) == "https://external.example.com"
|
||||
@@ -764,7 +782,8 @@ async def test_get_external_url_with_base_url_fallback(hass: HomeAssistant):
|
||||
|
||||
# Add external URL, mixed results
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "http://external.example.com:8123"},
|
||||
hass,
|
||||
{"external_url": "http://external.example.com:8123"},
|
||||
)
|
||||
assert _get_external_url(hass) == "http://external.example.com:8123"
|
||||
assert _get_external_url(hass, allow_ip=False) == "http://external.example.com:8123"
|
||||
@@ -773,7 +792,8 @@ async def test_get_external_url_with_base_url_fallback(hass: HomeAssistant):
|
||||
|
||||
# Add external URL set to an IP
|
||||
await async_process_ha_core_config(
|
||||
hass, {"external_url": "http://1.1.1.1:8123"},
|
||||
hass,
|
||||
{"external_url": "http://1.1.1.1:8123"},
|
||||
)
|
||||
assert _get_external_url(hass) == "http://1.1.1.1:8123"
|
||||
assert _get_external_url(hass, allow_ip=False) == "https://example.com"
|
||||
|
||||
Reference in New Issue
Block a user