Disallow ambiguous color descriptors in the light.turn_on schema (#7765)

* Disallow ambiguous color descriptors in the light.turn_on schema

* Update tests
This commit is contained in:
Anders Melchiorsen authored and Paulus Schoutsen committed 2017-06-01 23:05:05 -07:00
1 parent 9480f41210
commit e2cfdbff06
5 files changed
+39 -24

No files matched your search

+8 -5
View File
@@ -206,10 +206,10 @@ class TestLight(unittest.TestCase):
# Test light profiles
light.turn_on(self.hass, dev1.entity_id, profile=prof_name)
# Specify a profile and attributes to overwrite it
# Specify a profile and a brightness attribute to overwrite it
light.turn_on(
self.hass, dev2.entity_id,
profile=prof_name, brightness=100, xy_color=(.4, .6))
profile=prof_name, brightness=100)
self.hass.block_till_done()
@@ -222,10 +222,10 @@ class TestLight(unittest.TestCase):
_, data = dev2.last_call('turn_on')
self.assertEqual(
{light.ATTR_BRIGHTNESS: 100,
light.ATTR_XY_COLOR: (.4, .6)},
light.ATTR_XY_COLOR: (.5119, .4147)},
data)
# Test shitty data
# Test bad data
light.turn_on(self.hass)
light.turn_on(self.hass, dev1.entity_id, profile="nonexisting")
light.turn_on(self.hass, dev2.entity_id, xy_color=["bla-di-bla", 5])
@@ -245,7 +245,10 @@ class TestLight(unittest.TestCase):
# faulty attributes will not trigger a service call
light.turn_on(
self.hass, dev1.entity_id,
profile=prof_name, brightness='bright', rgb_color='yellowish')
profile=prof_name, brightness='bright')
light.turn_on(
self.hass, dev1.entity_id,
rgb_color='yellowish')
light.turn_on(
self.hass, dev2.entity_id,
white_value='high')