mirror of
https://github.com/home-assistant/core.git
synced 2025-11-13 13:00:11 +00:00
Automatically onboard DiscoveryFlows (#73841)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user