From 959c2205d511aa7991ee209cf6e9d7549595b363 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 8 Mar 2023 16:18:07 +0100 Subject: [PATCH] Add missing mock in airvisual config flow tests (#89359) --- tests/components/airvisual/conftest.py | 10 ++++++++++ tests/components/airvisual/test_config_flow.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/tests/components/airvisual/conftest.py b/tests/components/airvisual/conftest.py index f6c1619d6d3..bdd325d4739 100644 --- a/tests/components/airvisual/conftest.py +++ b/tests/components/airvisual/conftest.py @@ -1,4 +1,5 @@ """Define test fixtures for AirVisual.""" +from collections.abc import Generator import json from unittest.mock import AsyncMock, Mock, patch @@ -141,3 +142,12 @@ async def setup_config_entry_fixture(hass, config_entry, mock_pyairvisual): """Define a fixture to set up airvisual.""" assert await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() + + +@pytest.fixture +def mock_setup_entry() -> Generator[AsyncMock, None, None]: + """Override async_setup_entry.""" + with patch( + "homeassistant.components.airvisual.async_setup_entry", return_value=True + ) as mock_setup_entry: + yield mock_setup_entry diff --git a/tests/components/airvisual/test_config_flow.py b/tests/components/airvisual/test_config_flow.py index b07a17972f7..1761f55d17f 100644 --- a/tests/components/airvisual/test_config_flow.py +++ b/tests/components/airvisual/test_config_flow.py @@ -32,6 +32,8 @@ from .conftest import ( TEST_STATE, ) +pytestmark = pytest.mark.usefixtures("mock_setup_entry") + @pytest.mark.parametrize( ("integration_type", "input_form_step", "patched_method", "config", "entry_title"),