Add context to login flow (#15914)

* Add context to login flow

* source -> context

* Fix unit test

* Update comment
This commit is contained in:
Jason Hu 2018-08-13 02:27:18 -07:00 committed by Paulus Schoutsen
parent 45f12dd3c7
commit 50daef9a52
15 changed files with 36 additions and 38 deletions

View file

@ -1,7 +1,7 @@
"""Tests for the Sonos config flow."""
from unittest.mock import patch
from homeassistant import data_entry_flow
from homeassistant import config_entries, data_entry_flow
from homeassistant.setup import async_setup_component
from homeassistant.components import sonos
@ -13,7 +13,8 @@ async def test_creating_entry_sets_up_media_player(hass):
with patch('homeassistant.components.media_player.sonos.async_setup_entry',
return_value=mock_coro(True)) as mock_setup, \
patch('soco.discover', return_value=True):
result = await hass.config_entries.flow.async_init(sonos.DOMAIN)
result = await hass.config_entries.flow.async_init(
sonos.DOMAIN, context={'source': config_entries.SOURCE_USER})
assert result['type'] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
await hass.async_block_till_done()