mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Add missing mock in webostv config flow tests (#88913)
This commit is contained in:
parent
ee144d34a9
commit
ac6bbc2f1c
@ -1,4 +1,5 @@
|
||||
"""Common fixtures and objects for the LG webOS integration tests."""
|
||||
from collections.abc import Generator
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
|
||||
import pytest
|
||||
@ -10,6 +11,15 @@ from .const import CHANNEL_1, CHANNEL_2, CLIENT_KEY, FAKE_UUID, MOCK_APPS, MOCK_
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.webostv.async_setup_entry", return_value=True
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def calls(hass):
|
||||
"""Track calls to a mock service."""
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""Test the WebOS Tv config flow."""
|
||||
import dataclasses
|
||||
from unittest.mock import Mock, patch
|
||||
from unittest.mock import Mock
|
||||
|
||||
from aiowebostv import WebOsTvPairError
|
||||
import pytest
|
||||
@ -16,6 +16,8 @@ from homeassistant.data_entry_flow import FlowResultType
|
||||
from . import setup_webostv
|
||||
from .const import CLIENT_KEY, FAKE_UUID, HOST, MOCK_APPS, MOCK_INPUTS, TV_NAME
|
||||
|
||||
pytestmark = pytest.mark.usefixtures("mock_setup_entry")
|
||||
|
||||
MOCK_USER_CONFIG = {
|
||||
CONF_HOST: HOST,
|
||||
CONF_NAME: TV_NAME,
|
||||
@ -65,10 +67,9 @@ async def test_form(hass: HomeAssistant, client) -> None:
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "pairing"
|
||||
|
||||
with patch("homeassistant.components.webostv.async_setup_entry", return_value=True):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -184,10 +185,9 @@ async def test_form_ssdp(hass: HomeAssistant, client) -> None:
|
||||
"""Test that the ssdp confirmation form is served."""
|
||||
assert client
|
||||
|
||||
with patch("homeassistant.components.webostv.async_setup_entry", return_value=True):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=MOCK_DISCOVERY_INFO
|
||||
)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={CONF_SOURCE: SOURCE_SSDP}, data=MOCK_DISCOVERY_INFO
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
|
Loading…
x
Reference in New Issue
Block a user