Automatically onboard DiscoveryFlows (#73841)
This commit is contained in:
parent
ec119ae718
commit
a8a033681f
2 changed files with 26 additions and 2 deletions
|
@ -139,6 +139,30 @@ async def test_discovery_confirmation(hass, discovery_flow_conf, source):
|
|||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source",
|
||||
[
|
||||
config_entries.SOURCE_DISCOVERY,
|
||||
config_entries.SOURCE_MQTT,
|
||||
config_entries.SOURCE_SSDP,
|
||||
config_entries.SOURCE_ZEROCONF,
|
||||
config_entries.SOURCE_DHCP,
|
||||
],
|
||||
)
|
||||
async def test_discovery_during_onboarding(hass, discovery_flow_conf, source):
|
||||
"""Test we create config entry via discovery during onboarding."""
|
||||
flow = config_entries.HANDLERS["test"]()
|
||||
flow.hass = hass
|
||||
flow.context = {"source": source}
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.onboarding.async_is_onboarded", return_value=False
|
||||
):
|
||||
result = await getattr(flow, f"async_step_{source}")({})
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
|
||||
|
||||
async def test_multiple_discoveries(hass, discovery_flow_conf):
|
||||
"""Test we only create one instance for multiple discoveries."""
|
||||
mock_entity_platform(hass, "config_flow.test", None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue