Add missing mock in freedompro config flow tests (#89442)

This commit is contained in:
epenet 2023-03-09 19:05:23 +01:00 committed by GitHub
parent f3084165b1
commit 3a4ce260b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -1,9 +1,10 @@
"""Fixtures for Freedompro integration tests.""" """Fixtures for Freedompro integration tests."""
from __future__ import annotations from __future__ import annotations
from collections.abc import Generator
from copy import deepcopy from copy import deepcopy
from typing import Any from typing import Any
from unittest.mock import patch from unittest.mock import AsyncMock, patch
import pytest import pytest
@ -14,6 +15,15 @@ from .const import DEVICES, DEVICES_STATE
from tests.common import MockConfigEntry from tests.common import MockConfigEntry
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
"""Override async_setup_entry."""
with patch(
"homeassistant.components.freedompro.async_setup_entry", return_value=True
) as mock_setup_entry:
yield mock_setup_entry
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_freedompro(): def mock_freedompro():
"""Mock freedompro get_list and get_states.""" """Mock freedompro get_list and get_states."""

View file

@ -1,6 +1,8 @@
"""Define tests for the Freedompro config flow.""" """Define tests for the Freedompro config flow."""
from unittest.mock import patch from unittest.mock import patch
import pytest
from homeassistant import data_entry_flow from homeassistant import data_entry_flow
from homeassistant.components.freedompro.const import DOMAIN from homeassistant.components.freedompro.const import DOMAIN
from homeassistant.config_entries import SOURCE_USER from homeassistant.config_entries import SOURCE_USER
@ -13,6 +15,8 @@ VALID_CONFIG = {
CONF_API_KEY: "ksdjfgslkjdfksjdfksjgfksjd", CONF_API_KEY: "ksdjfgslkjdfksjdfksjgfksjd",
} }
pytestmark = pytest.mark.usefixtures("mock_setup_entry")
async def test_show_form(hass: HomeAssistant) -> None: async def test_show_form(hass: HomeAssistant) -> None:
"""Test that the form is served with no input.""" """Test that the form is served with no input."""