Bugfixes random (#2270)

* Fix Z-Wave autoheal network

* Make config_per_platform handle bad config better
This commit is contained in:
Paulus Schoutsen 2016-06-10 22:53:31 -07:00 committed by GitHub
parent b60806583c
commit c9756c40e2
3 changed files with 33 additions and 13 deletions

View file

@ -1,5 +1,6 @@
"""Test component helpers."""
# pylint: disable=protected-access,too-many-public-methods
from collections import OrderedDict
import unittest
from homeassistant import helpers
@ -30,3 +31,19 @@ class TestHelpers(unittest.TestCase):
self.assertEqual(set(['zone', 'zone Hallo', 'zone 100']),
set(helpers.extract_domain_configs(config, 'zone')))
def test_config_per_platform(self):
"""Test config per platform method."""
config = OrderedDict([
('zone', {'platform': 'hello'}),
('zoner', None),
('zone Hallo', [1, {'platform': 'hello 2'}]),
('zone 100', None),
])
assert [
('hello', config['zone']),
(None, 1),
('hello 2', config['zone Hallo'][1]),
(None, None)
] == list(helpers.config_per_platform(config, 'zone'))