Use snapshot assertion for Cpuspeed diagnostics test (#98907)
This commit is contained in:
parent
34b47a2597
commit
360d2de1e1
2 changed files with 22 additions and 8 deletions
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."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
@ -12,6 +14,7 @@ async def test_diagnostics(
|
|||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
init_integration: MockConfigEntry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
info = {
|
||||
|
@ -25,11 +28,7 @@ async def test_diagnostics(
|
|||
"homeassistant.components.cpuspeed.diagnostics.cpuinfo.get_cpu_info",
|
||||
return_value=info,
|
||||
):
|
||||
assert await get_diagnostics_for_config_entry(
|
||||
hass, hass_client, init_integration
|
||||
) == {
|
||||
"hz_actual": [3200000001, 0],
|
||||
"arch_string_raw": "aargh",
|
||||
"brand_raw": "Intel Ryzen 7",
|
||||
"hz_advertised": [3600000001, 0],
|
||||
}
|
||||
assert (
|
||||
await get_diagnostics_for_config_entry(hass, hass_client, init_integration)
|
||||
== snapshot
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue