Add translation key for IPP printer integration (#84441)

* Add translation key for IPP printer integration

* Add tests
This commit is contained in:
Paul Bottein
2023-01-04 00:56:46 +01:00
committed by GitHub
parent 516cb31635
commit dd0f11a062
4 changed files with 37 additions and 1 deletions

View File

@@ -3,7 +3,10 @@ from datetime import datetime
from unittest.mock import patch
from homeassistant.components.ipp.const import DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.sensor import (
ATTR_OPTIONS as SENSOR_ATTR_OPTIONS,
DOMAIN as SENSOR_DOMAIN,
)
from homeassistant.const import ATTR_ICON, ATTR_UNIT_OF_MEASUREMENT, PERCENTAGE
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
@@ -41,6 +44,11 @@ async def test_sensors(
assert state
assert state.attributes.get(ATTR_ICON) == "mdi:printer"
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
assert state.attributes.get(SENSOR_ATTR_OPTIONS) == ["idle", "printing", "stopped"]
entry = registry.async_get("sensor.epson_xp_6000_series")
assert entry
assert entry.translation_key == "printer"
state = hass.states.get("sensor.epson_xp_6000_series_black_ink")
assert state