Set brand icon as entity picture on update entities (#69200)

Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>
This commit is contained in:
Franck Nijhof 2022-04-03 20:38:05 +02:00 committed by GitHub
parent bd1d7bdbb7
commit b644e7ed0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 8 deletions

View file

@ -39,7 +39,7 @@ from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.event import async_track_state_change_event
from homeassistant.setup import async_setup_component
from tests.common import mock_restore_cache
from tests.common import MockEntityPlatform, mock_restore_cache
class MockUpdateEntity(UpdateEntity):
@ -58,6 +58,7 @@ async def test_update(hass: HomeAssistant) -> None:
update._attr_title = "Title"
assert update.entity_category is EntityCategory.DIAGNOSTIC
assert update.entity_picture is None
assert update.installed_version == "1.0.0"
assert update.latest_version == "1.0.1"
assert update.release_summary == "Summary"
@ -76,6 +77,13 @@ async def test_update(hass: HomeAssistant) -> None:
ATTR_TITLE: "Title",
}
# Test with platform
update.platform = MockEntityPlatform(hass)
assert (
update.entity_picture
== "https://brands.home-assistant.io/_/test_platform/icon.png"
)
# Test no update available
update._attr_installed_version = "1.0.0"
update._attr_latest_version = "1.0.0"