Add context to login flow (#15914)
* Add context to login flow * source -> context * Fix unit test * Update comment
This commit is contained in:
parent
45f12dd3c7
commit
50daef9a52
15 changed files with 36 additions and 38 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue