diff --git a/script/scaffold/templates/config_flow_oauth2/tests/test_config_flow.py b/script/scaffold/templates/config_flow_oauth2/tests/test_config_flow.py index ec332de13e2..8a543a04af3 100644 --- a/script/scaffold/templates/config_flow_oauth2/tests/test_config_flow.py +++ b/script/scaffold/templates/config_flow_oauth2/tests/test_config_flow.py @@ -1,4 +1,6 @@ """Test the NEW_NAME config flow.""" +from asynctest import patch + from homeassistant import config_entries, setup from homeassistant.components.NEW_DOMAIN.const import ( DOMAIN, @@ -48,6 +50,10 @@ async def test_full_flow(hass, aiohttp_client, aioclient_mock): }, ) - result = await hass.config_entries.flow.async_configure(result["flow_id"]) + with patch( + "homeassistant.components.NEW_DOMAIN.async_setup_entry", return_value=True + ) as mock_setup: + await hass.config_entries.flow.async_configure(result["flow_id"]) assert len(hass.config_entries.async_entries(DOMAIN)) == 1 + assert len(mock_setup.mock_calls) == 1 diff --git a/tests/components/almond/test_config_flow.py b/tests/components/almond/test_config_flow.py index 0b402ed407d..0b4869ee2a6 100644 --- a/tests/components/almond/test_config_flow.py +++ b/tests/components/almond/test_config_flow.py @@ -1,6 +1,7 @@ """Test the Almond config flow.""" import asyncio -from unittest.mock import patch + +from asynctest import patch from homeassistant import config_entries, data_entry_flow, setup from homeassistant.components.almond import config_flow @@ -55,7 +56,12 @@ async def test_hassio(hass): assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "hassio_confirm" - result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) + with patch( + "homeassistant.components.almond.async_setup_entry", return_value=True + ) as mock_setup: + result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {}) + + assert len(mock_setup.mock_calls) == 1 assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY @@ -128,7 +134,12 @@ async def test_full_flow(hass, aiohttp_client, aioclient_mock): }, ) - result = await hass.config_entries.flow.async_configure(result["flow_id"]) + with patch( + "homeassistant.components.almond.async_setup_entry", return_value=True + ) as mock_setup: + result = await hass.config_entries.flow.async_configure(result["flow_id"]) + + assert len(mock_setup.mock_calls) == 1 assert len(hass.config_entries.async_entries(DOMAIN)) == 1 entry = hass.config_entries.async_entries(DOMAIN)[0] diff --git a/tests/components/netatmo/test_config_flow.py b/tests/components/netatmo/test_config_flow.py index d76578d277c..c9a663991cb 100644 --- a/tests/components/netatmo/test_config_flow.py +++ b/tests/components/netatmo/test_config_flow.py @@ -1,4 +1,6 @@ """Test the Netatmo config flow.""" +from asynctest import patch + from homeassistant import config_entries, data_entry_flow, setup from homeassistant.components.netatmo import config_flow from homeassistant.components.netatmo.const import ( @@ -88,6 +90,10 @@ async def test_full_flow(hass, aiohttp_client, aioclient_mock): }, ) - result = await hass.config_entries.flow.async_configure(result["flow_id"]) + with patch( + "homeassistant.components.netatmo.async_setup_entry", return_value=True + ) as mock_setup: + await hass.config_entries.flow.async_configure(result["flow_id"]) assert len(hass.config_entries.async_entries(DOMAIN)) == 1 + assert len(mock_setup.mock_calls) == 1