IGN Sismologia icon for geolocation entities ()

* define icon

* fixed tests
pull/26413/head
Malte Franken 2019-09-04 11:58:40 +10:00 committed by Andrew Sayre
parent 4e2fcdb9a3
commit 2f9de2a5a5
2 changed files with 9 additions and 0 deletions
homeassistant/components/ign_sismologia
tests/components/ign_sismologia

View File

@ -201,6 +201,11 @@ class IgnSismologiaLocationEvent(GeolocationEvent):
self._publication_date = feed_entry.published
self._image_url = feed_entry.image_url
@property
def icon(self):
"""Return the icon to use in the frontend."""
return "mdi:pulse"
@property
def source(self) -> str:
"""Return source value of this external event."""

View File

@ -23,6 +23,7 @@ from homeassistant.const import (
ATTR_ATTRIBUTION,
CONF_LATITUDE,
CONF_LONGITUDE,
ATTR_ICON,
)
from homeassistant.setup import async_setup_component
from tests.common import assert_setup_component, async_fire_time_changed
@ -126,6 +127,7 @@ async def test_setup(hass):
ATTR_MAGNITUDE: 5.7,
ATTR_UNIT_OF_MEASUREMENT: "km",
ATTR_SOURCE: "ign_sismologia",
ATTR_ICON: "mdi:pulse",
}
assert float(state.state) == 15.5
@ -141,6 +143,7 @@ async def test_setup(hass):
ATTR_MAGNITUDE: 4.6,
ATTR_UNIT_OF_MEASUREMENT: "km",
ATTR_SOURCE: "ign_sismologia",
ATTR_ICON: "mdi:pulse",
}
assert float(state.state) == 20.5
@ -156,6 +159,7 @@ async def test_setup(hass):
ATTR_REGION: "Region 3",
ATTR_UNIT_OF_MEASUREMENT: "km",
ATTR_SOURCE: "ign_sismologia",
ATTR_ICON: "mdi:pulse",
}
assert float(state.state) == 25.5