From addc2a6766460fca849632aea4bc37569698f925 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 27 Feb 2026 20:30:47 +0100 Subject: [PATCH] Mock async_setup_entry in speedtestdotnet config flow test (#164387) --- tests/components/speedtestdotnet/conftest.py | 10 ++++++++++ tests/components/speedtestdotnet/test_config_flow.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/components/speedtestdotnet/conftest.py b/tests/components/speedtestdotnet/conftest.py index a48e7a878ff7..fc30fe02ad86 100644 --- a/tests/components/speedtestdotnet/conftest.py +++ b/tests/components/speedtestdotnet/conftest.py @@ -7,6 +7,16 @@ import pytest from . import MOCK_SERVERS +@pytest.fixture +def mock_setup_entry(): + """Mock setting up a config entry.""" + with patch( + "homeassistant.components.speedtestdotnet.async_setup_entry", + return_value=True, + ) as mock_setup: + yield mock_setup + + @pytest.fixture def mock_api(): """Mock entry setup.""" diff --git a/tests/components/speedtestdotnet/test_config_flow.py b/tests/components/speedtestdotnet/test_config_flow.py index 883f60aaf0a0..77c7a5de5e28 100644 --- a/tests/components/speedtestdotnet/test_config_flow.py +++ b/tests/components/speedtestdotnet/test_config_flow.py @@ -14,7 +14,7 @@ from homeassistant.data_entry_flow import FlowResultType from tests.common import MockConfigEntry -async def test_flow_works(hass: HomeAssistant) -> None: +async def test_flow_works(hass: HomeAssistant, mock_setup_entry: MagicMock) -> None: """Test user config.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}