mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Add setup platform tests for the season sensor component. (#10270)
This commit is contained in:
parent
4dc9ac820f
commit
513c2b03c9
@ -3,11 +3,39 @@
|
|||||||
import unittest
|
import unittest
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from homeassistant.setup import setup_component
|
||||||
import homeassistant.components.sensor.season as season
|
import homeassistant.components.sensor.season as season
|
||||||
|
|
||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
|
|
||||||
|
|
||||||
|
HEMISPHERE_NORTHERN = {
|
||||||
|
'homeassistant': {
|
||||||
|
'latitude': '48.864716',
|
||||||
|
'longitude': '2.349014',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HEMISPHERE_SOUTHERN = {
|
||||||
|
'homeassistant': {
|
||||||
|
'latitude': '-33.918861',
|
||||||
|
'longitude': '18.423300',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HEMISPHERE_EQUATOR = {
|
||||||
|
'homeassistant': {
|
||||||
|
'latitude': '0',
|
||||||
|
'longitude': '-51.065100',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HEMISPHERE_EMPTY = {
|
||||||
|
'homeassistant': {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
class TestSeason(unittest.TestCase):
|
class TestSeason(unittest.TestCase):
|
||||||
"""Test the season platform."""
|
"""Test the season platform."""
|
||||||
@ -181,3 +209,10 @@ class TestSeason(unittest.TestCase):
|
|||||||
season.EQUATOR,
|
season.EQUATOR,
|
||||||
season.TYPE_ASTRONOMICAL)
|
season.TYPE_ASTRONOMICAL)
|
||||||
self.assertEqual(None, current_season)
|
self.assertEqual(None, current_season)
|
||||||
|
|
||||||
|
def test_setup_hemisphere(self):
|
||||||
|
"""Test platform setup of different hemispheres."""
|
||||||
|
assert setup_component(self.hass, 'sensor', HEMISPHERE_NORTHERN)
|
||||||
|
assert setup_component(self.hass, 'sensor', HEMISPHERE_SOUTHERN)
|
||||||
|
assert setup_component(self.hass, 'sensor', HEMISPHERE_EQUATOR)
|
||||||
|
assert setup_component(self.hass, 'sensor', HEMISPHERE_EMPTY)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user