Convert config.components to a set (#5824)
This commit is contained in:
1 parent
f3b9fa2f41
commit
c54517de90
44 files changed
+118
-104
No files matched your search
@@ -99,7 +99,7 @@ class TestLightMQTT(unittest.TestCase):
|
||||
|
||||
def test_fail_setup_if_no_command_topic(self):
|
||||
"""Test if command fails with command topic."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(0):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -112,7 +112,7 @@ class TestLightMQTT(unittest.TestCase):
|
||||
def test_no_color_or_brightness_or_color_temp_if_no_topics(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test if there is no color and brightness if no topic."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -157,7 +157,7 @@ class TestLightMQTT(unittest.TestCase):
|
||||
'payload_off': 0
|
||||
}}
|
||||
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, config)
|
||||
|
||||
@@ -213,7 +213,7 @@ class TestLightMQTT(unittest.TestCase):
|
||||
|
||||
def test_controlling_scale(self):
|
||||
"""Test the controlling scale."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -276,7 +276,7 @@ class TestLightMQTT(unittest.TestCase):
|
||||
'rgb_value_template': '{{ value_json.hello | join(",") }}',
|
||||
}}
|
||||
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, config)
|
||||
|
||||
@@ -316,7 +316,7 @@ class TestLightMQTT(unittest.TestCase):
|
||||
'payload_off': 'off'
|
||||
}}
|
||||
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, config)
|
||||
|
||||
@@ -373,7 +373,7 @@ class TestLightMQTT(unittest.TestCase):
|
||||
'state_topic': 'test_light_rgb/status',
|
||||
}}
|
||||
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, config)
|
||||
|
||||
@@ -398,7 +398,7 @@ class TestLightMQTT(unittest.TestCase):
|
||||
'state_topic': 'test_light_rgb/status'
|
||||
}}
|
||||
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, config)
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class TestLightMQTTJSON(unittest.TestCase):
|
||||
def test_fail_setup_if_no_command_topic(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test if setup fails with no command topic."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(0):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -66,7 +66,7 @@ class TestLightMQTTJSON(unittest.TestCase):
|
||||
def test_no_color_or_brightness_if_no_config(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test if there is no color and brightness if they aren't defined."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
'platform': 'mqtt_json',
|
||||
@@ -92,7 +92,7 @@ class TestLightMQTTJSON(unittest.TestCase):
|
||||
def test_controlling_state_via_topic(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test the controlling of the state via topic."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
'platform': 'mqtt_json',
|
||||
@@ -152,7 +152,7 @@ class TestLightMQTTJSON(unittest.TestCase):
|
||||
def test_sending_mqtt_commands_and_optimistic(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test the sending of command in optimistic mode."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
'platform': 'mqtt_json',
|
||||
@@ -208,7 +208,7 @@ class TestLightMQTTJSON(unittest.TestCase):
|
||||
def test_flash_short_and_long(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test for flash length being sent when included."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
'platform': 'mqtt_json',
|
||||
@@ -250,7 +250,7 @@ class TestLightMQTTJSON(unittest.TestCase):
|
||||
|
||||
def test_transition(self):
|
||||
"""Test for transition time being sent when included."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
'platform': 'mqtt_json',
|
||||
@@ -292,7 +292,7 @@ class TestLightMQTTJSON(unittest.TestCase):
|
||||
def test_invalid_color_and_brightness_values(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test that invalid color/brightness values are ignored."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
'platform': 'mqtt_json',
|
||||
|
||||
@@ -45,7 +45,7 @@ class TestLightMQTTTemplate(unittest.TestCase):
|
||||
def test_setup_fails(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test that setup fails with missing required configuration items."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(0):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -58,7 +58,7 @@ class TestLightMQTTTemplate(unittest.TestCase):
|
||||
def test_state_change_via_topic(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test state change via topic."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -93,7 +93,7 @@ class TestLightMQTTTemplate(unittest.TestCase):
|
||||
def test_state_brightness_color_effect_change_via_topic(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test state, brightness, color and effect change via topic."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -170,7 +170,7 @@ class TestLightMQTTTemplate(unittest.TestCase):
|
||||
def test_optimistic(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test optimistic mode."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -232,7 +232,7 @@ class TestLightMQTTTemplate(unittest.TestCase):
|
||||
def test_flash(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test flash."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -276,7 +276,7 @@ class TestLightMQTTTemplate(unittest.TestCase):
|
||||
|
||||
def test_transition(self):
|
||||
"""Test for transition time being sent when included."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
@@ -320,7 +320,7 @@ class TestLightMQTTTemplate(unittest.TestCase):
|
||||
def test_invalid_values(self): \
|
||||
# pylint: disable=invalid-name
|
||||
"""Test that invalid values are ignored."""
|
||||
self.hass.config.components = ['mqtt']
|
||||
self.hass.config.components = set(['mqtt'])
|
||||
with assert_setup_component(1):
|
||||
assert setup_component(self.hass, light.DOMAIN, {
|
||||
light.DOMAIN: {
|
||||
|
||||
@@ -16,7 +16,7 @@ class TestLightRfxtrx(unittest.TestCase):
|
||||
def setUp(self):
|
||||
"""Setup things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
self.hass.config.components = ['rfxtrx']
|
||||
self.hass.config.components = set(['rfxtrx'])
|
||||
|
||||
def tearDown(self):
|
||||
"""Stop everything that was started."""
|
||||
|
||||
Reference in new issue
Block a user