mirror of
https://github.com/home-assistant/core.git
synced 2026-02-26 12:55:16 +00:00
* 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 2405751f5a.
* resolve requested changes and fix test
* Fix Snapshot
* clean up
* Fixed unknown state in snapshot test
46 lines
1.3 KiB
Python
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)
|