Correct device class in `sql` tests (#107663)
parent
1a6418d361
commit
33dd6f66e3
|
@ -18,6 +18,7 @@ from homeassistant.const import (
|
|||
CONF_UNIQUE_ID,
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
CONF_VALUE_TEMPLATE,
|
||||
UnitOfInformation,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.trigger_template_entity import (
|
||||
|
@ -170,10 +171,10 @@ YAML_CONFIG = {
|
|||
CONF_NAME: "Get Value",
|
||||
CONF_QUERY: "SELECT 5 as value",
|
||||
CONF_COLUMN_NAME: "value",
|
||||
CONF_UNIT_OF_MEASUREMENT: "MiB",
|
||||
CONF_UNIT_OF_MEASUREMENT: UnitOfInformation.MEBIBYTES,
|
||||
CONF_UNIQUE_ID: "unique_id_12345",
|
||||
CONF_VALUE_TEMPLATE: "{{ value }}",
|
||||
CONF_DEVICE_CLASS: SensorDeviceClass.DATA_RATE,
|
||||
CONF_DEVICE_CLASS: SensorDeviceClass.DATA_SIZE,
|
||||
CONF_STATE_CLASS: SensorStateClass.MEASUREMENT,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ from homeassistant.const import (
|
|||
CONF_UNIQUE_ID,
|
||||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
UnitOfInformation,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
|
@ -401,9 +402,9 @@ async def test_attributes_from_yaml_setup(
|
|||
state = hass.states.get("sensor.get_value")
|
||||
|
||||
assert state.state == "5"
|
||||
assert state.attributes["device_class"] == SensorDeviceClass.DATA_RATE
|
||||
assert state.attributes["device_class"] == SensorDeviceClass.DATA_SIZE
|
||||
assert state.attributes["state_class"] == SensorStateClass.MEASUREMENT
|
||||
assert state.attributes["unit_of_measurement"] == "MiB"
|
||||
assert state.attributes["unit_of_measurement"] == UnitOfInformation.MEBIBYTES
|
||||
|
||||
|
||||
async def test_binary_data_from_yaml_setup(
|
||||
|
|
Loading…
Reference in New Issue