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 authored and Paulus Schoutsen committed 2018-08-14 22:06:40 +02:00
1 parent 6d432d19fe
commit 34e1f1b6da
15 files changed
+36 -38

No files matched your search

+3 -2
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()