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 2018-07-23 15:08:03 +02:00 committed by GitHub
parent f3dfc433c2
commit 3204501174
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 2 deletions

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