geniushub: add water heater platform tests (#167763)

Co-authored-by: Joostlek <joostlek@outlook.com>
This commit is contained in:
wibbit
2026-04-09 14:11:41 +01:00
committed by GitHub
parent cc21c99e55
commit 998f24649d
3 changed files with 1695 additions and 310 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,81 @@
# serializer version: 1
# name: test_cloud_all_water_heaters[water_heater.hot_water-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': dict({
'max_temp': 80.0,
'min_temp': 30.0,
'operation_list': list([
'off',
'auto',
'manual',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'water_heater',
'entity_category': None,
'entity_id': 'water_heater.hot_water',
'has_entity_name': False,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Hot Water',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Hot Water',
'platform': 'geniushub',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': <WaterHeaterEntityFeature: 3>,
'translation_key': None,
'unique_id': '01J71MQF0EC62D620DGYNG2R8H_zone_10',
'unit_of_measurement': None,
})
# ---
# name: test_cloud_all_water_heaters[water_heater.hot_water-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 45.5,
'friendly_name': 'Hot Water',
'max_temp': 80.0,
'min_temp': 30.0,
'operation_list': list([
'off',
'auto',
'manual',
]),
'operation_mode': 'manual',
'status': dict({
'mode': 'override',
'override': dict({
'duration': 3600,
'setpoint': 80,
}),
'temperature': 45.5,
'type': 'hot water temperature',
}),
'supported_features': <WaterHeaterEntityFeature: 3>,
'target_temp_high': None,
'target_temp_low': None,
'temperature': 60,
}),
'context': <ANY>,
'entity_id': 'water_heater.hot_water',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'manual',
})
# ---

View File

@@ -0,0 +1,30 @@
"""Tests for the Geniushub water heater platform."""
from unittest.mock import patch
import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import setup_integration
from tests.common import MockConfigEntry, snapshot_platform
@pytest.mark.usefixtures("mock_geniushub_cloud")
async def test_cloud_all_water_heaters(
hass: HomeAssistant,
mock_cloud_config_entry: MockConfigEntry,
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test the creation of the Genius Hub water heater entities."""
with patch("homeassistant.components.geniushub.PLATFORMS", [Platform.WATER_HEATER]):
await setup_integration(hass, mock_cloud_config_entry)
await snapshot_platform(
hass, entity_registry, snapshot, mock_cloud_config_entry.entry_id
)