Service validation for light.turn_on/.turn_off/.toggle

This commit is contained in:
Jan Harkes 2016-03-31 18:24:06 -04:00
parent 5bd58351c7
commit 017f47dd2c
3 changed files with 45 additions and 73 deletions

View file

@ -212,6 +212,7 @@ class TestLight(unittest.TestCase):
data)
# Test shitty 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])
light.turn_on(self.hass, dev3.entity_id, rgb_color=[255, None, 2])
@ -227,7 +228,7 @@ class TestLight(unittest.TestCase):
method, data = dev3.last_call('turn_on')
self.assertEqual({}, data)
# faulty attributes should not overwrite profile data
# faulty attributes will not trigger a service call
light.turn_on(
self.hass, dev1.entity_id,
profile=prof_name, brightness='bright', rgb_color='yellowish')
@ -235,10 +236,7 @@ class TestLight(unittest.TestCase):
self.hass.pool.block_till_done()
method, data = dev1.last_call('turn_on')
self.assertEqual(
{light.ATTR_BRIGHTNESS: prof_bri,
light.ATTR_XY_COLOR: [prof_x, prof_y]},
data)
self.assertEqual({}, data)
def test_broken_light_profiles(self):
"""Test light profiles."""