Cast/Sonos: create config entry if manually configured (#15630)

* Cast/Sonos: create config entry if manually configured

* Add test for helper
This commit is contained in:
Paulus Schoutsen authored and Paulus Schoutsen committed 2018-07-24 11:20:07 +02:00
1 parent 3eda6db227
commit 45a5ae1f23
6 files changed
+109 -2

No files matched your search

+21
View File
@@ -114,3 +114,24 @@ async def test_user_init_trumps_discovery(hass, flow_conf):
# Discovery flow has been aborted
assert len(hass.config_entries.flow.async_progress()) == 0
async def test_import_no_confirmation(hass, flow_conf):
"""Test import requires no confirmation to setup."""
flow = config_entries.HANDLERS['test']()
flow.hass = hass
flow_conf['discovered'] = True
result = await flow.async_step_import(None)
assert result['type'] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
async def test_import_single_instance(hass, flow_conf):
"""Test import doesn't create second instance."""
flow = config_entries.HANDLERS['test']()
flow.hass = hass
flow_conf['discovered'] = True
MockConfigEntry(domain='test').add_to_hass(hass)
result = await flow.async_step_import(None)
assert result['type'] == data_entry_flow.RESULT_TYPE_ABORT