Filter out falsey platform configs
This commit is contained in:
parent
d3a012a536
commit
ac4e54c6ff
3 changed files with 19 additions and 10 deletions
|
@ -110,14 +110,6 @@ class TestBootstrap:
|
|||
loader.set_component(
|
||||
'platform_conf.whatever', MockPlatform('whatever'))
|
||||
|
||||
assert not bootstrap._setup_component(self.hass, 'platform_conf', {
|
||||
'platform_conf': None
|
||||
})
|
||||
|
||||
assert not bootstrap._setup_component(self.hass, 'platform_conf', {
|
||||
'platform_conf': {}
|
||||
})
|
||||
|
||||
assert not bootstrap._setup_component(self.hass, 'platform_conf', {
|
||||
'platform_conf': {
|
||||
'hello': 'world',
|
||||
|
@ -150,6 +142,8 @@ class TestBootstrap:
|
|||
}
|
||||
})
|
||||
|
||||
self.hass.config.components.remove('platform_conf')
|
||||
|
||||
assert bootstrap._setup_component(self.hass, 'platform_conf', {
|
||||
'platform_conf': [{
|
||||
'platform': 'whatever',
|
||||
|
@ -157,6 +151,19 @@ class TestBootstrap:
|
|||
}]
|
||||
})
|
||||
|
||||
self.hass.config.components.remove('platform_conf')
|
||||
|
||||
# Any falsey paltform config will be ignored (None, {}, etc)
|
||||
assert bootstrap._setup_component(self.hass, 'platform_conf', {
|
||||
'platform_conf': None
|
||||
})
|
||||
|
||||
self.hass.config.components.remove('platform_conf')
|
||||
|
||||
assert bootstrap._setup_component(self.hass, 'platform_conf', {
|
||||
'platform_conf': {}
|
||||
})
|
||||
|
||||
def test_component_not_found(self):
|
||||
"""setup_component should not crash if component doesn't exist."""
|
||||
assert not bootstrap.setup_component(self.hass, 'non_existing')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue