mirror of
https://github.com/elisspace/core.git
synced 2026-10-02 07:19:59 +00:00
Fix hue discovery popping up (#14614)
* Fix hue discovery popping up * Fix result * Fix tests
This commit is contained in:
committed by
Paulus Schoutsen
parent
69e86c29a6
commit
ef35b8d428
@@ -284,3 +284,23 @@ async def test_discovery_notification(hass):
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get('persistent_notification.config_entry_discovery')
|
||||
assert state is None
|
||||
|
||||
|
||||
async def test_discovery_notification_not_created(hass):
|
||||
"""Test that we not create a notification when discovery is aborted."""
|
||||
loader.set_component(hass, 'test', MockModule('test'))
|
||||
await async_setup_component(hass, 'persistent_notification', {})
|
||||
|
||||
class TestFlow(data_entry_flow.FlowHandler):
|
||||
VERSION = 5
|
||||
|
||||
async def async_step_discovery(self, user_input=None):
|
||||
return self.async_abort(reason='test')
|
||||
|
||||
with patch.dict(config_entries.HANDLERS, {'test': TestFlow}):
|
||||
await hass.config_entries.flow.async_init(
|
||||
'test', source=data_entry_flow.SOURCE_DISCOVERY)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get('persistent_notification.config_entry_discovery')
|
||||
assert state is None
|
||||
|
||||
@@ -21,7 +21,8 @@ def manager():
|
||||
return handler()
|
||||
|
||||
async def async_add_entry(result):
|
||||
entries.append(result)
|
||||
if (result['type'] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY):
|
||||
entries.append(result)
|
||||
|
||||
manager = data_entry_flow.FlowManager(
|
||||
None, async_create_flow, async_add_entry)
|
||||
|
||||
Reference in New Issue
Block a user