1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-27 04:03:49 +01:00

Use async_load_fixture in async test functions (a) (#145718)

This commit is contained in:
epenet
2025-05-28 15:51:49 +02:00
committed by GitHub
parent c3ade400fb
commit bd5fef1ddb
11 changed files with 69 additions and 46 deletions

View File

@@ -18,7 +18,7 @@ from . import setup_integration
from tests.common import (
MockConfigEntry,
async_fire_time_changed,
load_fixture,
async_load_fixture,
snapshot_platform,
)
@@ -46,14 +46,14 @@ async def test_create_entities(
) -> None:
"""Test creating entities."""
mock_airgradient_client.get_current_measures.return_value = Measures.from_json(
load_fixture("measures_after_boot.json", DOMAIN)
await async_load_fixture(hass, "measures_after_boot.json", DOMAIN)
)
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(
load_fixture("current_measures_indoor.json", DOMAIN)
await async_load_fixture(hass, "current_measures_indoor.json", DOMAIN)
)
freezer.tick(timedelta(minutes=1))
async_fire_time_changed(hass)