Add and use percentage constant (#32094)
* Add and use percentage constant * Fix pylint error and broken test
This commit is contained in:
1 parent
c7f128f286
commit
f1a0ca7cd3
155 files changed
+735
-459
No files matched your search
@@ -1,7 +1,7 @@
|
||||
"""Tests for the Start.ca sensor platform."""
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.startca.sensor import StartcaData
|
||||
from homeassistant.const import DATA_GIGABYTES
|
||||
from homeassistant.const import DATA_GIGABYTES, UNIT_PERCENTAGE
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ async def test_capped_setup(hass, aioclient_mock):
|
||||
await async_setup_component(hass, "sensor", {"sensor": config})
|
||||
|
||||
state = hass.states.get("sensor.start_ca_usage_ratio")
|
||||
assert state.attributes.get("unit_of_measurement") == "%"
|
||||
assert state.attributes.get("unit_of_measurement") == UNIT_PERCENTAGE
|
||||
assert state.state == "76.24"
|
||||
|
||||
state = hass.states.get("sensor.start_ca_usage")
|
||||
@@ -147,7 +147,7 @@ async def test_unlimited_setup(hass, aioclient_mock):
|
||||
await async_setup_component(hass, "sensor", {"sensor": config})
|
||||
|
||||
state = hass.states.get("sensor.start_ca_usage_ratio")
|
||||
assert state.attributes.get("unit_of_measurement") == "%"
|
||||
assert state.attributes.get("unit_of_measurement") == UNIT_PERCENTAGE
|
||||
assert state.state == "0"
|
||||
|
||||
state = hass.states.get("sensor.start_ca_usage")
|
||||
|
||||
Reference in new issue
Block a user