1
mirror of https://github.com/home-assistant/core synced 2024-09-15 17:29:45 +02:00

Add missing mock in fibaro config flow tests (#89440)

This commit is contained in:
epenet 2023-03-09 19:04:07 +01:00 committed by GitHub
parent 01d8eaa5b6
commit 4e4608183e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -0,0 +1,14 @@
"""Test helpers."""
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.fibaro.async_setup_entry", return_value=True
) as mock_setup_entry:
yield mock_setup_entry

View File

@ -20,6 +20,8 @@ TEST_USERNAME = "user"
TEST_PASSWORD = "password"
TEST_VERSION = "4.360"
pytestmark = pytest.mark.usefixtures("mock_setup_entry")
@pytest.fixture(name="fibaro_client", autouse=True)
def fibaro_client_fixture():
@ -69,9 +71,6 @@ async def test_config_flow_user_initiated_success(hass: HomeAssistant) -> None:
with patch(
"homeassistant.components.fibaro.FibaroClient.connect",
return_value=True,
), patch(
"homeassistant.components.fibaro.async_setup_entry",
return_value=True,
):
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
@ -239,9 +238,6 @@ async def test_reauth_success(hass: HomeAssistant) -> None:
with patch(
"homeassistant.components.fibaro.FibaroClient.connect", return_value=True
), patch(
"homeassistant.components.fibaro.async_setup_entry",
return_value=True,
):
result = await hass.config_entries.flow.async_configure(
result["flow_id"],