1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Use UNIT_PERCENTAGE constant (#34054)

This commit is contained in:
springstan
2020-04-11 22:53:48 +02:00
committed by GitHub
parent 4f50b858d0
commit 9f713dac7f
6 changed files with 27 additions and 19 deletions

View File

@@ -3,6 +3,7 @@
from asynctest import patch
from homeassistant.components.powerwall.const import DOMAIN
from homeassistant.const import UNIT_PERCENTAGE
from homeassistant.setup import async_setup_component
from .mocks import _mock_get_config, _mock_powerwall_with_fixtures
@@ -17,7 +18,7 @@ async def test_sensors(hass):
"homeassistant.components.powerwall.config_flow.PowerWall",
return_value=mock_powerwall,
), patch(
"homeassistant.components.powerwall.PowerWall", return_value=mock_powerwall,
"homeassistant.components.powerwall.PowerWall", return_value=mock_powerwall
):
assert await async_setup_component(hass, DOMAIN, _mock_get_config())
await hass.async_block_till_done()
@@ -99,7 +100,7 @@ async def test_sensors(hass):
state = hass.states.get("sensor.powerwall_charge")
assert state.state == "47.32"
expected_attributes = {
"unit_of_measurement": "%",
"unit_of_measurement": UNIT_PERCENTAGE,
"friendly_name": "Powerwall Charge",
"device_class": "battery",
}