From 813e60d31ae7da18f84f9bbcc3a34d109fbe84e7 Mon Sep 17 00:00:00 2001 From: Chris Talkington Date: Fri, 3 Jul 2020 17:31:57 -0500 Subject: [PATCH] Mock setup in directv config flow tests (#37439) * mock setup in directv config flow tests * Update test_config_flow.py --- tests/components/directv/test_config_flow.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/components/directv/test_config_flow.py b/tests/components/directv/test_config_flow.py index 78eddf57c30..ca9e3f41dbf 100644 --- a/tests/components/directv/test_config_flow.py +++ b/tests/components/directv/test_config_flow.py @@ -205,9 +205,12 @@ async def test_full_import_flow_implementation( mock_connection(aioclient_mock) user_input = MOCK_USER_INPUT.copy() - result = await hass.config_entries.flow.async_init( - DOMAIN, context={CONF_SOURCE: SOURCE_IMPORT}, data=user_input, - ) + with patch( + "homeassistant.components.directv.async_setup_entry", return_value=True + ), patch("homeassistant.components.directv.async_setup", return_value=True): + result = await hass.config_entries.flow.async_init( + DOMAIN, context={CONF_SOURCE: SOURCE_IMPORT}, data=user_input, + ) assert result["type"] == RESULT_TYPE_CREATE_ENTRY assert result["title"] == HOST @@ -231,9 +234,12 @@ async def test_full_user_flow_implementation( assert result["step_id"] == "user" user_input = MOCK_USER_INPUT.copy() - result = await hass.config_entries.flow.async_configure( - result["flow_id"], user_input=user_input, - ) + with patch( + "homeassistant.components.directv.async_setup_entry", return_value=True + ), patch("homeassistant.components.directv.async_setup", return_value=True): + result = await hass.config_entries.flow.async_configure( + result["flow_id"], user_input=user_input, + ) assert result["type"] == RESULT_TYPE_CREATE_ENTRY assert result["title"] == HOST