Add missing mock in freedompro config flow tests (#89442)
This commit is contained in:
parent
f3084165b1
commit
3a4ce260b4
2 changed files with 15 additions and 1 deletions
|
@ -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."""
|
||||||
|
|
|
@ -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."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue