core/tests/components/iometer/test_init.py
jukrebs 0ddf3c794b
Add attachment and connection status for IOmeter (#140998)
* add binary sensors

* fix: suggestion value_fn

* add snapshot test and split cases
2025-03-25 13:26:07 +01:00

45 lines
1.6 KiB
Python

"""Tests for the AirGradient integration."""
from datetime import timedelta
from unittest.mock import AsyncMock
from freezegun.api import FrozenDateTimeFactory
from homeassistant.components.iometer.const import DOMAIN
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from . import setup_platform
from tests.common import MockConfigEntry, async_fire_time_changed
async def test_new_firmware_version(
hass: HomeAssistant,
mock_iometer_client: AsyncMock,
mock_config_entry: MockConfigEntry,
device_registry: dr.DeviceRegistry,
freezer: FrozenDateTimeFactory,
) -> None:
"""Test device registry integration."""
# await setup_integration(hass, mock_config_entry)
await setup_platform(hass, mock_config_entry, [Platform.SENSOR])
device_entry = device_registry.async_get_device(
identifiers={(DOMAIN, mock_config_entry.unique_id)}
)
assert device_entry is not None
assert device_entry.sw_version == "build-58/build-65"
mock_iometer_client.get_current_status.return_value.device.core.version = "build-62"
mock_iometer_client.get_current_status.return_value.device.bridge.version = (
"build-69"
)
freezer.tick(timedelta(minutes=1))
async_fire_time_changed(hass)
await hass.async_block_till_done()
device_entry = device_registry.async_get_device(
identifiers={(DOMAIN, mock_config_entry.unique_id)}
)
assert device_entry is not None
assert device_entry.sw_version == "build-62/build-69"