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

+4 -2
View File
@@ -25,8 +25,10 @@ def manager():
if context is not None else 'user_input'
return flow
async def async_add_entry(result):
async def async_add_entry(context, result):
if (result['type'] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY):
result['source'] = context.get('source') \
if context is not None else 'user'
entries.append(result)
manager = data_entry_flow.FlowManager(
@@ -168,7 +170,7 @@ async def test_create_saves_data(manager):
assert entry['handler'] == 'test'
assert entry['title'] == 'Test Title'
assert entry['data'] == 'Test Data'
assert entry['source'] == 'user_input'
assert entry['source'] == 'user'
async def test_discovery_init_flow(manager):