diff --git a/tests/components/notion/conftest.py b/tests/components/notion/conftest.py index a66d99d41ce..7484e8a997f 100644 --- a/tests/components/notion/conftest.py +++ b/tests/components/notion/conftest.py @@ -1,4 +1,5 @@ """Define fixtures for Notion tests.""" +from collections.abc import Generator import json from unittest.mock import AsyncMock, Mock, patch @@ -13,6 +14,15 @@ TEST_USERNAME = "user@host.com" TEST_PASSWORD = "password123" +@pytest.fixture +def mock_setup_entry() -> Generator[AsyncMock, None, None]: + """Override async_setup_entry.""" + with patch( + "homeassistant.components.notion.async_setup_entry", return_value=True + ) as mock_setup_entry: + yield mock_setup_entry + + @pytest.fixture(name="client") def client_fixture(data_bridge, data_sensor, data_task): """Define a fixture for an aionotion client.""" diff --git a/tests/components/notion/test_config_flow.py b/tests/components/notion/test_config_flow.py index d0d1cad0350..e9f340fae17 100644 --- a/tests/components/notion/test_config_flow.py +++ b/tests/components/notion/test_config_flow.py @@ -12,6 +12,8 @@ from homeassistant.core import HomeAssistant from .conftest import TEST_PASSWORD, TEST_USERNAME +pytestmark = pytest.mark.usefixtures("mock_setup_entry") + @pytest.mark.parametrize( ("get_client_with_exception", "errors"), @@ -58,7 +60,7 @@ async def test_create_entry( } -async def test_duplicate_error(hass: HomeAssistant, config, setup_config_entry) -> None: +async def test_duplicate_error(hass: HomeAssistant, config, config_entry) -> None: """Test that errors are shown when duplicates are added.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=config @@ -81,7 +83,7 @@ async def test_reauth( config_entry, errors, get_client_with_exception, - setup_config_entry, + mock_aionotion, ) -> None: """Test that re-auth works.""" result = await hass.config_entries.flow.async_init(