Move mock_setup_entry to conftest (#88484)

This commit is contained in:
epenet 2023-03-06 11:31:50 +01:00 committed by GitHub
parent ea4d2bd1e8
commit bf5f7c53d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 115 additions and 89 deletions

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from collections.abc import Generator
from unittest.mock import MagicMock, create_autospec, patch
from unittest.mock import AsyncMock, MagicMock, create_autospec, patch
from asyncsleepiq import (
Side,
@ -40,6 +40,15 @@ SLEEPIQ_CONFIG = {
}
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
"""Override async_setup_entry."""
with patch(
"homeassistant.components.sleepiq.async_setup_entry", return_value=True
) as mock_setup_entry:
yield mock_setup_entry
@pytest.fixture
def mock_bed() -> MagicMock:
"""Mock a SleepIQBed object with sleepers and lights."""