Gracefully handle no uuid in kodi discovery (#43494)

This commit is contained in:
On Freund
2020-11-23 09:05:31 +00:00
committed by Paulus Schoutsen
parent 99399cfd29
commit e94111f725
4 changed files with 27 additions and 2 deletions
+11
View File
@@ -11,6 +11,7 @@ from homeassistant.components.kodi.const import DEFAULT_TIMEOUT, DOMAIN
from .util import (
TEST_CREDENTIALS,
TEST_DISCOVERY,
TEST_DISCOVERY_WO_UUID,
TEST_HOST,
TEST_IMPORT,
TEST_WS_PORT,
@@ -573,6 +574,16 @@ async def test_discovery_updates_unique_id(hass):
assert entry.data["name"] == "hostname"
async def test_discovery_without_unique_id(hass):
"""Test a discovery flow with no unique id aborts."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "zeroconf"}, data=TEST_DISCOVERY_WO_UUID
)
assert result["type"] == "abort"
assert result["reason"] == "no_uuid"
async def test_form_import(hass):
"""Test we get the form with import source."""
with patch(
+10
View File
@@ -24,6 +24,16 @@ TEST_DISCOVERY = {
}
TEST_DISCOVERY_WO_UUID = {
"host": "1.1.1.1",
"port": 8080,
"hostname": "hostname.local.",
"type": "_xbmc-jsonrpc-h._tcp.local.",
"name": "hostname._xbmc-jsonrpc-h._tcp.local.",
"properties": {},
}
TEST_IMPORT = {
"name": "name",
"host": "1.1.1.1",