Add icon translations to Github (#111614)

* Add icon translations to Github

* Fix
This commit is contained in:
Joost Lekkerkerker 2024-03-20 07:06:34 +01:00 committed by GitHub
parent 510e7ccf76
commit 23353812a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 64 additions and 6 deletions

View file

@ -4,7 +4,7 @@ import pytest
from homeassistant.components.github import CONF_REPOSITORIES
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers import device_registry as dr, entity_registry as er, icon
from .common import setup_github_integration
@ -21,7 +21,7 @@ async def test_device_registry_cleanup(
aioclient_mock: AiohttpClientMocker,
caplog: pytest.LogCaptureFixture,
) -> None:
"""Test that we remove untracked repositories from the decvice registry."""
"""Test that we remove untracked repositories from the device registry."""
mock_config_entry.add_to_hass(hass)
hass.config_entries.async_update_entry(
mock_config_entry,
@ -113,3 +113,22 @@ async def test_subscription_setup_polling_disabled(
"https://api.github.com/repos/home-assistant/core/events" in x[1]
for x in aioclient_mock.mock_calls
)
# This tests needs to be adjusted to remove lingering tasks
@pytest.mark.parametrize("expected_lingering_tasks", [True])
async def test_sensor_icons(
hass: HomeAssistant,
init_integration: MockConfigEntry,
entity_registry: er.EntityRegistry,
) -> None:
"""Test to ensure that all sensor entities have an icon definition."""
entities = er.async_entries_for_config_entry(
entity_registry,
config_entry_id=init_integration.entry_id,
)
icons = await icon.async_get_icons(hass, "entity", integrations=["github"])
for entity in entities:
assert entity.translation_key is not None
assert icons["github"]["sensor"][entity.translation_key] is not None