Add diagnostics support to CPU Speed (#64745)
* Add diagnostics support to CPU Speed * Fix copy pasta error
This commit is contained in:
parent
88c9422b70
commit
22656f6082
2 changed files with 53 additions and 0 deletions
36
tests/components/cpuspeed/test_diagnostics.py
Normal file
36
tests/components/cpuspeed/test_diagnostics.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
"""Tests for the diagnostics data provided by the CPU Speed integration."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
|
||||
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSession,
|
||||
init_integration: MockConfigEntry,
|
||||
):
|
||||
"""Test diagnostics."""
|
||||
info = {
|
||||
"hz_actual": (3200000001, 0),
|
||||
"arch_string_raw": "aargh",
|
||||
"brand_raw": "Intel Ryzen 7",
|
||||
"hz_advertised": (3600000001, 0),
|
||||
}
|
||||
|
||||
with patch(
|
||||
"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],
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue