Add bare hostname as valid known hostname in get_url helper (#40510)

This commit is contained in:
Franck Nijhof 2020-09-26 09:36:03 +02:00 committed by GitHub
parent 35cfc80dd7
commit c64eec3238
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -848,6 +848,14 @@ async def test_get_current_request_url_with_known_host(
== "http://homeassistant.local:8123"
)
with patch(
"homeassistant.helpers.network._get_request_host",
return_value="homeassistant",
):
assert (
get_url(hass, require_current_request=True) == "http://homeassistant:8123"
)
with patch(
"homeassistant.helpers.network._get_request_host", return_value="unknown.local"
), pytest.raises(NoURLAvailableError):