deCONZ - manual input fallback in config flow (#18116)

* Add config flow step for manual input
Remove support for loading discovery config from json file

* Small cleanup
Fix all translations to step user instead of step init

* Revert to using step_init

* Small cleanup
Add test_gateway that was forgotten in a previous PR

* Fix hound comment

* Fix empty pydocstring
This commit is contained in:
Robert Svensson authored and Paulus Schoutsen committed 2018-11-06 10:34:24 +01:00
1 parent 24c110ad3c
commit c5d0440041
9 files changed
+274 -100

No files matched your search

+3 -19
View File
@@ -21,8 +21,7 @@ CONFIG = {
async def test_config_with_host_passed_to_config_entry(hass):
"""Test that configured options for a host are loaded via config entry."""
with patch.object(hass, 'config_entries') as mock_config_entries, \
patch.object(deconz, 'configured_hosts', return_value=[]), \
patch.object(deconz, 'load_json', return_value={}):
patch.object(deconz, 'configured_hosts', return_value=[]):
assert await async_setup_component(hass, deconz.DOMAIN, {
deconz.DOMAIN: {
deconz.CONF_HOST: '1.2.3.4',
@@ -33,24 +32,10 @@ async def test_config_with_host_passed_to_config_entry(hass):
assert len(mock_config_entries.flow.mock_calls) == 2
async def test_config_file_passed_to_config_entry(hass):
"""Test that configuration file for a host are loaded via config entry."""
with patch.object(hass, 'config_entries') as mock_config_entries, \
patch.object(deconz, 'configured_hosts', return_value=[]), \
patch.object(deconz, 'load_json',
return_value={'host': '1.2.3.4'}):
assert await async_setup_component(hass, deconz.DOMAIN, {
deconz.DOMAIN: {}
}) is True
# Import flow started
assert len(mock_config_entries.flow.mock_calls) == 2
async def test_config_without_host_not_passed_to_config_entry(hass):
"""Test that a configuration without a host does not initiate an import."""
with patch.object(hass, 'config_entries') as mock_config_entries, \
patch.object(deconz, 'configured_hosts', return_value=[]), \
patch.object(deconz, 'load_json', return_value={}):
patch.object(deconz, 'configured_hosts', return_value=[]):
assert await async_setup_component(hass, deconz.DOMAIN, {
deconz.DOMAIN: {}
}) is True
@@ -62,8 +47,7 @@ async def test_config_already_registered_not_passed_to_config_entry(hass):
"""Test that an already registered host does not initiate an import."""
with patch.object(hass, 'config_entries') as mock_config_entries, \
patch.object(deconz, 'configured_hosts',
return_value=['1.2.3.4']), \
patch.object(deconz, 'load_json', return_value={}):
return_value=['1.2.3.4']):
assert await async_setup_component(hass, deconz.DOMAIN, {
deconz.DOMAIN: {
deconz.CONF_HOST: '1.2.3.4',