Add snapshot tests to Balboa (#117620)

This commit is contained in:
Joost Lekkerkerker 2024-05-17 15:38:39 +02:00 committed by GitHub
parent 081bf1cc39
commit 0b8a5ac9ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 478 additions and 32 deletions

View file

@ -2,26 +2,30 @@
from __future__ import annotations
from unittest.mock import MagicMock, call
from unittest.mock import MagicMock, call, patch
from pybalboa import SpaControl
from pybalboa.enums import LowHighRange
import pytest
from syrupy import SnapshotAssertion
from homeassistant.components.select import (
ATTR_OPTION,
DOMAIN as SELECT_DOMAIN,
SERVICE_SELECT_OPTION,
)
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.const import ATTR_ENTITY_ID, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import client_update, init_integration
from tests.common import snapshot_platform
ENTITY_SELECT = "select.fakespa_temperature_range"
@pytest.fixture
@pytest.fixture(autouse=True)
def mock_select(client: MagicMock):
"""Return a mock switch."""
select = MagicMock(SpaControl)
@ -36,6 +40,19 @@ def mock_select(client: MagicMock):
return select
async def test_selects(
hass: HomeAssistant,
client: MagicMock,
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test spa climate."""
with patch("homeassistant.components.balboa.PLATFORMS", [Platform.SELECT]):
entry = await init_integration(hass)
await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id)
async def test_select(hass: HomeAssistant, client: MagicMock, mock_select) -> None:
"""Test spa temperature range select."""
await init_integration(hass)