From adb4414440632613dd614a0fd3fc0bee7071747a Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 8 Mar 2023 08:43:07 +0100 Subject: [PATCH] Add missing mock in brother config flow tests (#89354) --- tests/components/brother/conftest.py | 14 ++++++++++++++ tests/components/brother/test_config_flow.py | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 tests/components/brother/conftest.py diff --git a/tests/components/brother/conftest.py b/tests/components/brother/conftest.py new file mode 100644 index 00000000000..9e81cce9d12 --- /dev/null +++ b/tests/components/brother/conftest.py @@ -0,0 +1,14 @@ +"""Test fixtures for brother.""" +from collections.abc import Generator +from unittest.mock import AsyncMock, patch + +import pytest + + +@pytest.fixture +def mock_setup_entry() -> Generator[AsyncMock, None, None]: + """Override async_setup_entry.""" + with patch( + "homeassistant.components.brother.async_setup_entry", return_value=True + ) as mock_setup_entry: + yield mock_setup_entry diff --git a/tests/components/brother/test_config_flow.py b/tests/components/brother/test_config_flow.py index 9dc871bb4ca..0e1db72ddae 100644 --- a/tests/components/brother/test_config_flow.py +++ b/tests/components/brother/test_config_flow.py @@ -3,6 +3,7 @@ import json from unittest.mock import patch from brother import SnmpError, UnsupportedModelError +import pytest from homeassistant import data_entry_flow from homeassistant.components import zeroconf @@ -15,6 +16,8 @@ from tests.common import MockConfigEntry, load_fixture CONFIG = {CONF_HOST: "127.0.0.1", CONF_TYPE: "laser"} +pytestmark = pytest.mark.usefixtures("mock_setup_entry") + async def test_show_form(hass: HomeAssistant) -> None: """Test that the form is served with no input."""