* No code duplication for profile application * Refactor color profile as a dataclass * Typing * Make color_x and color_y of a Light profile optional * Update tests * Make brightness field of a Light profile optional * Transition can be of a float type * Allow fractional transition times in light profiles Make transition of a float type. Allow transition to be optional with 5 column CSV files. * Make pylint happy * Fix dropped async_mock * Simplify CSV row schema
25 lines
549 B
Python
25 lines
549 B
Python
"""Light conftest."""
|
|
|
|
from unittest.mock import AsyncMock, patch
|
|
|
|
import pytest
|
|
|
|
from homeassistant.components.light import Profiles
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def mock_light_profiles():
|
|
"""Mock loading of profiles."""
|
|
data = {}
|
|
|
|
def mock_profiles_class(hass):
|
|
profiles = Profiles(hass)
|
|
profiles.data = data
|
|
profiles.async_initialize = AsyncMock()
|
|
return profiles
|
|
|
|
with patch(
|
|
"homeassistant.components.light.Profiles",
|
|
side_effect=mock_profiles_class,
|
|
):
|
|
yield data
|