2016-03-09 09:25:50 +00:00
|
|
|
"""Test component helpers."""
|
2014-12-07 07:57:02 +00:00
|
|
|
# pylint: disable=protected-access,too-many-public-methods
|
|
|
|
import unittest
|
|
|
|
|
2016-01-24 06:57:14 +00:00
|
|
|
from homeassistant import helpers
|
2014-12-07 07:57:02 +00:00
|
|
|
|
2015-09-13 05:56:49 +00:00
|
|
|
from tests.common import get_test_home_assistant
|
|
|
|
|
2014-12-07 07:57:02 +00:00
|
|
|
|
2016-01-24 06:57:14 +00:00
|
|
|
class TestHelpers(unittest.TestCase):
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Tests homeassistant.helpers module."""
|
2014-12-07 07:57:02 +00:00
|
|
|
|
|
|
|
def setUp(self): # pylint: disable=invalid-name
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Init needed objects."""
|
2014-12-07 07:57:02 +00:00
|
|
|
self.hass = get_test_home_assistant()
|
|
|
|
|
|
|
|
def tearDown(self): # pylint: disable=invalid-name
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Stop everything that was started."""
|
2014-12-07 07:57:02 +00:00
|
|
|
self.hass.stop()
|
|
|
|
|
2015-09-29 06:09:05 +00:00
|
|
|
def test_extract_domain_configs(self):
|
2016-03-09 09:25:50 +00:00
|
|
|
"""Test the extraction of domain configuration."""
|
2015-09-29 06:09:05 +00:00
|
|
|
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')))
|