Use init_subclass for Config Entries (#26059)
* Use init_subclass for Config Entries * Ignore type
This commit is contained in:
parent
33c35a6c3c
commit
cf2d927f14
4 changed files with 26 additions and 21 deletions
|
@ -521,31 +521,32 @@ async def test_discovery_notification(hass):
|
|||
mock_entity_platform(hass, "config_flow.test", None)
|
||||
await async_setup_component(hass, "persistent_notification", {})
|
||||
|
||||
class TestFlow(config_entries.ConfigFlow):
|
||||
VERSION = 5
|
||||
with patch.dict(config_entries.HANDLERS):
|
||||
|
||||
async def async_step_discovery(self, user_input=None):
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(
|
||||
title="Test Title", data={"token": "abcd"}
|
||||
)
|
||||
return self.async_show_form(step_id="discovery")
|
||||
class TestFlow(config_entries.ConfigFlow, domain="test"):
|
||||
VERSION = 5
|
||||
|
||||
async def async_step_discovery(self, user_input=None):
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(
|
||||
title="Test Title", data={"token": "abcd"}
|
||||
)
|
||||
return self.async_show_form(step_id="discovery")
|
||||
|
||||
with patch.dict(config_entries.HANDLERS, {"test": TestFlow}):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
"test", context={"source": config_entries.SOURCE_DISCOVERY}
|
||||
)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get("persistent_notification.config_entry_discovery")
|
||||
assert state is not None
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get("persistent_notification.config_entry_discovery")
|
||||
assert state is not None
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get("persistent_notification.config_entry_discovery")
|
||||
assert state is None
|
||||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue