mirror of
https://github.com/home-assistant/core.git
synced 2026-04-06 23:47:33 +00:00
Add analytics platform to wled (#153258)
This commit is contained in:
committed by
Franck Nijhof
parent
6d09411c07
commit
00f6d26ede
11
homeassistant/components/wled/analytics.py
Normal file
11
homeassistant/components/wled/analytics.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""Analytics platform."""
|
||||
|
||||
from homeassistant.components.analytics import AnalyticsInput, AnalyticsModifications
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
async def async_modify_analytics(
|
||||
hass: HomeAssistant, analytics_input: AnalyticsInput
|
||||
) -> AnalyticsModifications:
|
||||
"""Modify the analytics."""
|
||||
return AnalyticsModifications(remove=True)
|
||||
31
tests/components/wled/test_analytics.py
Normal file
31
tests/components/wled/test_analytics.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Tests for analytics platform."""
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.analytics import async_devices_payload
|
||||
from homeassistant.components.wled import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_analytics(
|
||||
hass: HomeAssistant, device_registry: dr.DeviceRegistry
|
||||
) -> None:
|
||||
"""Test the analytics platform."""
|
||||
await async_setup_component(hass, "analytics", {})
|
||||
|
||||
config_entry = MockConfigEntry(domain=DOMAIN, data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||
identifiers={(DOMAIN, "test")},
|
||||
manufacturer="Test Manufacturer",
|
||||
)
|
||||
|
||||
result = await async_devices_payload(hass)
|
||||
assert DOMAIN not in result["integrations"]
|
||||
Reference in New Issue
Block a user