mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use snapshot assertion for Cpuspeed diagnostics test (#98907)
This commit is contained in:
parent
34b47a2597
commit
360d2de1e1
15
tests/components/cpuspeed/snapshots/test_diagnostics.ambr
Normal file
15
tests/components/cpuspeed/snapshots/test_diagnostics.ambr
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# serializer version: 1
|
||||||
|
# name: test_diagnostics
|
||||||
|
dict({
|
||||||
|
'arch_string_raw': 'aargh',
|
||||||
|
'brand_raw': 'Intel Ryzen 7',
|
||||||
|
'hz_actual': list([
|
||||||
|
3200000001,
|
||||||
|
0,
|
||||||
|
]),
|
||||||
|
'hz_advertised': list([
|
||||||
|
3600000001,
|
||||||
|
0,
|
||||||
|
]),
|
||||||
|
})
|
||||||
|
# ---
|
@ -1,6 +1,8 @@
|
|||||||
"""Tests for the diagnostics data provided by the CPU Speed integration."""
|
"""Tests for the diagnostics data provided by the CPU Speed integration."""
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from syrupy import SnapshotAssertion
|
||||||
|
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
@ -12,6 +14,7 @@ async def test_diagnostics(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_client: ClientSessionGenerator,
|
hass_client: ClientSessionGenerator,
|
||||||
init_integration: MockConfigEntry,
|
init_integration: MockConfigEntry,
|
||||||
|
snapshot: SnapshotAssertion,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test diagnostics."""
|
"""Test diagnostics."""
|
||||||
info = {
|
info = {
|
||||||
@ -25,11 +28,7 @@ async def test_diagnostics(
|
|||||||
"homeassistant.components.cpuspeed.diagnostics.cpuinfo.get_cpu_info",
|
"homeassistant.components.cpuspeed.diagnostics.cpuinfo.get_cpu_info",
|
||||||
return_value=info,
|
return_value=info,
|
||||||
):
|
):
|
||||||
assert await get_diagnostics_for_config_entry(
|
assert (
|
||||||
hass, hass_client, init_integration
|
await get_diagnostics_for_config_entry(hass, hass_client, init_integration)
|
||||||
) == {
|
== snapshot
|
||||||
"hz_actual": [3200000001, 0],
|
)
|
||||||
"arch_string_raw": "aargh",
|
|
||||||
"brand_raw": "Intel Ryzen 7",
|
|
||||||
"hz_advertised": [3600000001, 0],
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user