Add entity name translations to prusalink entities (#90833)

This commit is contained in:
Paul Bottein
2023-04-05 17:36:52 +02:00
committed by Franck Nijhof
parent 2a23583d67
commit 65b877bb77
6 changed files with 50 additions and 16 deletions
+5 -5
View File
@@ -25,12 +25,12 @@ async def test_camera_no_job(
) -> None:
"""Test camera while no job active."""
assert await async_setup_component(hass, "prusalink", {})
state = hass.states.get("camera.mock_title_job_preview")
state = hass.states.get("camera.mock_title_preview")
assert state is not None
assert state.state == "unavailable"
client = await hass_client()
resp = await client.get("/api/camera_proxy/camera.mock_title_job_preview")
resp = await client.get("/api/camera_proxy/camera.mock_title_preview")
assert resp.status == 500
@@ -43,19 +43,19 @@ async def test_camera_active_job(
) -> None:
"""Test camera while job active."""
assert await async_setup_component(hass, "prusalink", {})
state = hass.states.get("camera.mock_title_job_preview")
state = hass.states.get("camera.mock_title_preview")
assert state is not None
assert state.state == "idle"
client = await hass_client()
with patch("pyprusalink.PrusaLink.get_large_thumbnail", return_value=b"hello"):
resp = await client.get("/api/camera_proxy/camera.mock_title_job_preview")
resp = await client.get("/api/camera_proxy/camera.mock_title_preview")
assert resp.status == 200
assert await resp.read() == b"hello"
# Make sure we hit cached value.
with patch("pyprusalink.PrusaLink.get_large_thumbnail", side_effect=ValueError):
resp = await client.get("/api/camera_proxy/camera.mock_title_job_preview")
resp = await client.get("/api/camera_proxy/camera.mock_title_preview")
assert resp.status == 200
assert await resp.read() == b"hello"
+1 -1
View File
@@ -49,7 +49,7 @@ async def test_sensors_no_job(hass: HomeAssistant, mock_config_entry, mock_api)
"printing",
]
state = hass.states.get("sensor.mock_title_heatbed")
state = hass.states.get("sensor.mock_title_heatbed_temperature")
assert state is not None
assert state.state == "41.9"
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == UnitOfTemperature.CELSIUS