Remove deprecated YAML configuration from CPU Speed (#67166)
This commit is contained in:
parent
85b87ffb8b
commit
14059c5aa9
4 changed files with 4 additions and 82 deletions
|
@ -3,8 +3,7 @@
|
|||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from homeassistant.components.cpuspeed.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
|
@ -62,26 +61,6 @@ async def test_already_configured(
|
|||
assert len(mock_cpuinfo_config_flow.mock_calls) == 0
|
||||
|
||||
|
||||
async def test_import_flow(
|
||||
hass: HomeAssistant,
|
||||
mock_cpuinfo_config_flow: MagicMock,
|
||||
mock_setup_entry: AsyncMock,
|
||||
) -> None:
|
||||
"""Test the import configuration flow."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_IMPORT},
|
||||
data={CONF_NAME: "Frenck's CPU"},
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result.get("title") == "Frenck's CPU"
|
||||
assert result.get("data") == {}
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
assert len(mock_cpuinfo_config_flow.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_not_compatible(
|
||||
hass: HomeAssistant,
|
||||
mock_cpuinfo_config_flow: MagicMock,
|
||||
|
|
|
@ -4,10 +4,8 @@ from unittest.mock import MagicMock
|
|||
import pytest
|
||||
|
||||
from homeassistant.components.cpuspeed.const import DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
@ -48,19 +46,3 @@ async def test_config_entry_not_compatible(
|
|||
assert mock_config_entry.state is ConfigEntryState.SETUP_ERROR
|
||||
assert len(mock_cpuinfo.mock_calls) == 1
|
||||
assert "is not compatible with your system" in caplog.text
|
||||
|
||||
|
||||
async def test_import_config(
|
||||
hass: HomeAssistant,
|
||||
mock_cpuinfo: MagicMock,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test the CPU Speed being set up from config via import."""
|
||||
assert await async_setup_component(
|
||||
hass, SENSOR_DOMAIN, {SENSOR_DOMAIN: {"platform": DOMAIN}}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
|
||||
assert len(mock_cpuinfo.mock_calls) == 3
|
||||
assert "the CPU Speed platform in YAML is deprecated" in caplog.text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue