core/tests/helpers/test_init.py

37 lines
953 B
Python
Raw Normal View History

"""
tests.helpers.test_init
~~~~~~~~~~~~~~~~~~~~~~~
Tests component helpers.
"""
# pylint: disable=protected-access,too-many-public-methods
import unittest
from homeassistant import helpers
2015-09-13 05:56:49 +00:00
from tests.common import get_test_home_assistant
class TestHelpers(unittest.TestCase):
""" Tests homeassistant.helpers module. """
def setUp(self): # pylint: disable=invalid-name
""" Init needed objects. """
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
""" Stop down stuff we started. """
self.hass.stop()
2015-09-29 06:09:05 +00:00
def test_extract_domain_configs(self):
config = {
'zone': None,
'zoner': None,
'zone ': None,
'zone Hallo': None,
'zone 100': None,
}
self.assertEqual(set(['zone', 'zone Hallo', 'zone 100']),
set(helpers.extract_domain_configs(config, 'zone')))