Hue tweak registered device type + discovery exception (#25977)

* Include location name in create user

* Guard against no host in context

* Fix tests and typing
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-08-16 16:19:00 -07:00
1 parent 6c292846be
commit 57ef721d5d
6 files changed
+18 -9

No files matched your search

+5
View File
@@ -255,6 +255,7 @@ async def test_import_with_existing_config(hass):
"""Test importing a host with an existing config file."""
flow = config_flow.HueFlowHandler()
flow.hass = hass
flow.context = {}
bridge = Mock()
bridge.username = "username-abc"
@@ -280,6 +281,7 @@ async def test_import_with_no_config(hass):
"""Test importing a host without an existing config file."""
flow = config_flow.HueFlowHandler()
flow.hass = hass
flow.context = {}
with patch.object(
config_flow, "get_bridge", side_effect=errors.AuthenticationRequired
@@ -294,6 +296,7 @@ async def test_import_with_existing_but_invalid_config(hass):
"""Test importing a host with a config file with invalid username."""
flow = config_flow.HueFlowHandler()
flow.hass = hass
flow.context = {}
with patch.object(
config_flow, "_find_username_from_config", return_value="mock-user"
@@ -310,6 +313,7 @@ async def test_import_cannot_connect(hass):
"""Test importing a host that we cannot conncet to."""
flow = config_flow.HueFlowHandler()
flow.hass = hass
flow.context = {}
with patch.object(config_flow, "get_bridge", side_effect=errors.CannotConnect):
result = await flow.async_step_import({"host": "0.0.0.0"})
@@ -337,6 +341,7 @@ async def test_creating_entry_removes_entries_for_same_host_or_bridge(hass):
flow = config_flow.HueFlowHandler()
flow.hass = hass
flow.context = {}
bridge = Mock()
bridge.username = "username-abc"