1
0
mirror of https://github.com/home-assistant/core.git synced 2025-06-04 05:07:08 +00:00
EnjoyingM c1c8deed0c
Fix sensor values for Power and Energy for Wolf Heatpumps ()
* Add sensor values for Power and Energy

* test

* test

* Sensor test

* Fix test

* fix test

* Fixing test coverage

* refactored

* WolfllinkSensorEntityDescriptions and updated tests

* fix test

* Add name_fn and test_sensor adoptions

* fix test coverage

* Revert "fix test coverage"

This reverts commit 2405751f5a9d0d5be67b78b39a510240a794a7e5.

* resolve requested changes and fix test

* Fix Snapshot

* clean up

* Fixed unknown state in snapshot test
2025-03-15 19:56:45 +01:00

46 lines
1.3 KiB
Python

"""Test the Wolf SmartSet Service Sensor platform."""
from unittest.mock import MagicMock
from syrupy import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr, entity_registry as er
from . import setup_integration
from tests.common import MockConfigEntry, patch, snapshot_platform
async def test_device_entry(
hass: HomeAssistant,
mock_wolflink: MagicMock,
mock_config_entry: MockConfigEntry,
device_registry: dr.DeviceRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test device entry creation."""
mock_config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
device = device_registry.async_get_device({(mock_config_entry.domain, "1234")})
assert device == snapshot
async def test_sensors(
hass: HomeAssistant,
mock_wolflink: MagicMock,
mock_config_entry: MockConfigEntry,
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test wolflink sensors."""
with patch("homeassistant.components.wolflink.PLATFORMS", [Platform.SENSOR]):
await setup_integration(hass, mock_config_entry)
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)