Add select entities to AirGradient (#117136)
This commit is contained in:
parent
6382cb9134
commit
c80718628e
12 changed files with 549 additions and 33 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Tests for the AirGradient sensor platform."""
|
||||
|
||||
from datetime import timedelta
|
||||
from unittest.mock import AsyncMock
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from airgradient import AirGradientError, Measures
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
|
@ -9,7 +9,7 @@ import pytest
|
|||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.airgradient import DOMAIN
|
||||
from homeassistant.const import STATE_UNAVAILABLE
|
||||
from homeassistant.const import STATE_UNAVAILABLE, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
|
@ -32,7 +32,8 @@ async def test_all_entities(
|
|||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test all entities."""
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
with patch("homeassistant.components.airgradient.PLATFORMS", [Platform.SENSOR]):
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
@ -47,7 +48,8 @@ async def test_create_entities(
|
|||
mock_airgradient_client.get_current_measures.return_value = Measures.from_json(
|
||||
load_fixture("measures_after_boot.json", DOMAIN)
|
||||
)
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
with patch("homeassistant.components.airgradient.PLATFORMS", [Platform.SENSOR]):
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
assert len(hass.states.async_all()) == 0
|
||||
mock_airgradient_client.get_current_measures.return_value = Measures.from_json(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue