mirror of
https://github.com/elisspace/core.git
synced 2026-09-29 13:59:54 +00:00
Fix CPUSpeed with missing info (#66339)
This commit is contained in:
committed by
Paulus Schoutsen
parent
f3a3ff28f2
commit
646c56e0e9
@@ -61,3 +61,25 @@ async def test_sensor(
|
||||
assert state.attributes.get(ATTR_ARCH) == "aargh"
|
||||
assert state.attributes.get(ATTR_BRAND) == "Intel Ryzen 7"
|
||||
assert state.attributes.get(ATTR_HZ) == 3.6
|
||||
|
||||
|
||||
async def test_sensor_partial_info(
|
||||
hass: HomeAssistant,
|
||||
mock_cpuinfo: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test the CPU Speed sensor missing info."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
# Pop some info from the mocked CPUSpeed
|
||||
mock_cpuinfo.return_value.pop("brand_raw")
|
||||
mock_cpuinfo.return_value.pop("arch_string_raw")
|
||||
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("sensor.cpu_speed")
|
||||
assert state
|
||||
assert state.state == "3.2"
|
||||
assert state.attributes.get(ATTR_ARCH) is None
|
||||
assert state.attributes.get(ATTR_BRAND) is None
|
||||
|
||||
Reference in New Issue
Block a user