hass-core/tests/components/teslemetry/test_sensor.py
Brett Adams b5528de807
Add sensor platform to Teslemetry ()
* Adding Energy

* Adding Energy

* Work in progress

* Add fixtures

* Add product info

* Add sensors

* Add icons

* Update metadata

* Use SensorEntityDescription for Energy

* Use ENERGY_STORAGE

* Add tests

* Fix coverage

* Update wall connector precision and units

* Change devices

* Fix serial number

* Add icons and VIN to wall connector

* Fix serial number again

* Update snapshots

* Use timestamp for minutes to arrival

* Cleanup snapshot

* Improvements

* Update fixture

* Add "code" to translations

* Add "code" to snapshot

* Use async_add_entities once

* Disable a bunch of sensors

* Ruff

* Improve fixture and test coverage

* Regen Snapshots

* Add init to coordinator
2024-03-04 18:42:56 +01:00

26 lines
799 B
Python

"""Test the Teslemetry sensor platform."""
from freezegun.api import FrozenDateTimeFactory
import pytest
from syrupy import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import assert_entities, setup_platform
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_sensors(
hass: HomeAssistant,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
freezer: FrozenDateTimeFactory,
) -> None:
"""Tests that the sensor entities are correct."""
freezer.move_to("2024-01-01 00:00:00+00:00")
entry = await setup_platform(hass, [Platform.SENSOR])
assert_entities(hass, entry.entry_id, entity_registry, snapshot)