mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Patch platform in Withings sensor test (#102155)
* Patch platform in Withings sensor test * Fix feedback
This commit is contained in:
parent
ea61160fd8
commit
857f2e1d86
@ -1,6 +1,6 @@
|
|||||||
"""Tests for the Withings component."""
|
"""Tests for the Withings component."""
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
from aiowithings import MeasurementGroup
|
from aiowithings import MeasurementGroup
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
@ -29,16 +29,16 @@ async def test_all_entities(
|
|||||||
polling_config_entry: MockConfigEntry,
|
polling_config_entry: MockConfigEntry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test all entities."""
|
"""Test all entities."""
|
||||||
|
with patch("homeassistant.components.withings.PLATFORMS", [Platform.SENSOR]):
|
||||||
await setup_integration(hass, polling_config_entry)
|
await setup_integration(hass, polling_config_entry)
|
||||||
entity_registry = er.async_get(hass)
|
entity_registry = er.async_get(hass)
|
||||||
entities = er.async_entries_for_config_entry(
|
entity_entries = er.async_entries_for_config_entry(
|
||||||
entity_registry, polling_config_entry.entry_id
|
entity_registry, polling_config_entry.entry_id
|
||||||
)
|
)
|
||||||
|
|
||||||
for entity in entities:
|
assert entity_entries
|
||||||
if entity.domain == Platform.SENSOR:
|
for entity_entry in entity_entries:
|
||||||
assert hass.states.get(entity.entity_id) == snapshot
|
assert hass.states.get(entity_entry.entity_id) == snapshot
|
||||||
assert entities
|
|
||||||
|
|
||||||
|
|
||||||
async def test_update_failed(
|
async def test_update_failed(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user