Add missing mock in braviatv config flow tests (#89419)
This commit is contained in:
parent
9faf251321
commit
b0631fed1d
2 changed files with 16 additions and 6 deletions
14
tests/components/braviatv/conftest.py
Normal file
14
tests/components/braviatv/conftest.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
"""Test fixtures for Bravia TV."""
|
||||
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.braviatv.async_setup_entry", return_value=True
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
|
@ -84,6 +84,8 @@ FAKE_BRAVIA_SSDP = ssdp.SsdpServiceInfo(
|
|||
},
|
||||
)
|
||||
|
||||
pytestmark = pytest.mark.usefixtures("mock_setup_entry")
|
||||
|
||||
|
||||
async def test_show_form(hass: HomeAssistant) -> None:
|
||||
"""Test that the form is served with no input."""
|
||||
|
@ -111,8 +113,6 @@ async def test_ssdp_discovery(hass: HomeAssistant) -> None:
|
|||
), patch("pybravia.BraviaClient.set_wol_mode"), patch(
|
||||
"pybravia.BraviaClient.get_system_info",
|
||||
return_value=BRAVIA_SYSTEM_INFO,
|
||||
), patch(
|
||||
"homeassistant.components.braviatv.async_setup_entry", return_value=True
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
|
@ -302,8 +302,6 @@ async def test_create_entry(hass: HomeAssistant) -> None:
|
|||
), patch("pybravia.BraviaClient.set_wol_mode"), patch(
|
||||
"pybravia.BraviaClient.get_system_info",
|
||||
return_value=BRAVIA_SYSTEM_INFO,
|
||||
), patch(
|
||||
"homeassistant.components.braviatv.async_setup_entry", return_value=True
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: "bravia-host"}
|
||||
|
@ -343,8 +341,6 @@ async def test_create_entry_psk(hass: HomeAssistant) -> None:
|
|||
), patch(
|
||||
"pybravia.BraviaClient.get_system_info",
|
||||
return_value=BRAVIA_SYSTEM_INFO,
|
||||
), patch(
|
||||
"homeassistant.components.braviatv.async_setup_entry", return_value=True
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: "bravia-host"}
|
||||
|
|
Loading…
Add table
Reference in a new issue