File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
homeassistant/components/esphome Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ """Analytics platform."""
2+
3+ from homeassistant .components .analytics import AnalyticsInput , AnalyticsModifications
4+ from homeassistant .core import HomeAssistant
5+
6+
7+ async def async_modify_analytics (
8+ hass : HomeAssistant , analytics_input : AnalyticsInput
9+ ) -> AnalyticsModifications :
10+ """Modify the analytics."""
11+ return AnalyticsModifications (remove = True )
Original file line number Diff line number Diff line change 1+ """Tests for analytics platform."""
2+
3+ import pytest
4+
5+ from homeassistant .components .analytics import async_devices_payload
6+ from homeassistant .components .esphome import DOMAIN
7+ from homeassistant .core import HomeAssistant
8+ from homeassistant .helpers import device_registry as dr
9+ from homeassistant .setup import async_setup_component
10+
11+ from tests .common import MockConfigEntry
12+
13+
14+ @pytest .mark .asyncio
15+ async def test_analytics (
16+ hass : HomeAssistant , device_registry : dr .DeviceRegistry
17+ ) -> None :
18+ """Test the analytics platform."""
19+ await async_setup_component (hass , "analytics" , {})
20+
21+ config_entry = MockConfigEntry (domain = DOMAIN , data = {})
22+ config_entry .add_to_hass (hass )
23+ device_registry .async_get_or_create (
24+ config_entry_id = config_entry .entry_id ,
25+ connections = {(dr .CONNECTION_NETWORK_MAC , "12:34:56:AB:CD:EF" )},
26+ identifiers = {(DOMAIN , "test" )},
27+ manufacturer = "Test Manufacturer" ,
28+ )
29+
30+ result = await async_devices_payload (hass )
31+ assert DOMAIN not in result ["integrations" ]
You can’t perform that action at this time.
0 commit comments