Update config_entry_flow test test_user_has_confirmation (#36633)

* Update test_user_has_confirmation

* Rewrite test according to review comment
pull/36751/head
Erik Montnemery 2020-06-13 06:43:13 +02:00 committed by GitHub
parent 1ffa8fcbba
commit 922b332766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -66,15 +66,19 @@ async def test_user_no_devices_found(hass, discovery_flow_conf):
async def test_user_has_confirmation(hass, discovery_flow_conf):
"""Test user requires no confirmation to setup."""
flow = config_entries.HANDLERS["test"]()
flow.hass = hass
flow.context = {}
"""Test user requires confirmation to setup."""
discovery_flow_conf["discovered"] = True
mock_entity_platform(hass, "config_flow.test", None)
result = await flow.async_step_user()
result = await hass.config_entries.flow.async_init(
"test", context={"source": config_entries.SOURCE_USER}, data={}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "confirm"
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
@pytest.mark.parametrize("source", ["discovery", "ssdp", "zeroconf"])