core/tests/components/teslemetry/test_device_tracker.py

37 lines
1.1 KiB
Python

"""Test the Teslemetry device tracker platform."""
from unittest.mock import AsyncMock
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 assert_entities, assert_entities_alt, setup_platform
from .const import VEHICLE_DATA_ALT
async def test_device_tracker(
hass: HomeAssistant,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
) -> None:
"""Tests that the device tracker entities are correct."""
entry = await setup_platform(hass, [Platform.DEVICE_TRACKER])
assert_entities(hass, entry.entry_id, entity_registry, snapshot)
async def test_device_tracker_alt(
hass: HomeAssistant,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
mock_vehicle_data: AsyncMock,
) -> None:
"""Tests that the device tracker entities are correct."""
mock_vehicle_data.return_value = VEHICLE_DATA_ALT
entry = await setup_platform(hass, [Platform.DEVICE_TRACKER])
assert_entities_alt(hass, entry.entry_id, entity_registry, snapshot)