From 922b332766f18f6c6cccd4490c4df1540cdc4e75 Mon Sep 17 00:00:00 2001
From: Erik Montnemery <erik@montnemery.com>
Date: Sat, 13 Jun 2020 06:43:13 +0200
Subject: [PATCH] Update config_entry_flow test test_user_has_confirmation
 (#36633)

* Update test_user_has_confirmation

* Rewrite test according to review comment
---
 tests/helpers/test_config_entry_flow.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/helpers/test_config_entry_flow.py b/tests/helpers/test_config_entry_flow.py
index 582dc79a310..7893650d420 100644
--- a/tests/helpers/test_config_entry_flow.py
+++ b/tests/helpers/test_config_entry_flow.py
@@ -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"])
-- 
GitLab