Files
core/tests/components/librenms/test_sensor.py
T

37 lines
1.1 KiB
Python

"""Test the LibreNMS sensor platform."""
from unittest.mock import Mock, patch
import pytest
from syrupy.assertion 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, snapshot_platform
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_sensors(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
device_registry: dr.DeviceRegistry,
snapshot: SnapshotAssertion,
mock_librenms: Mock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test the LibreNMS sensor platform."""
with patch("homeassistant.components.librenms.PLATFORMS", [Platform.SENSOR]):
await setup_integration(hass, mock_config_entry)
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
devices = dr.async_entries_for_config_entry(
device_registry, mock_config_entry.entry_id
)
assert devices == snapshot