Expanded switch test to push it to 100% coverage

pull/12/head
Paulus Schoutsen 2014-11-25 00:33:02 -08:00
parent 100948eb38
commit 3e348880d5
2 changed files with 6 additions and 2 deletions

View File

@ -38,7 +38,8 @@ FAKE_NO_SWITCHES = False
SWITCHES = [
MockSwitch('AC', components.STATE_ON),
MockSwitch('AC', components.STATE_OFF)
MockSwitch('AC', components.STATE_OFF),
MockSwitch(None, components.STATE_OFF)
]

View File

@ -28,7 +28,7 @@ class TestSwitch(unittest.TestCase):
))
# Switch 1 is ON, switch 2 is OFF
self.switch_1, self.switch_2 = \
self.switch_1, self.switch_2, self.switch_3 = \
mock_switch_platform.get_switches(None, None)
def tearDown(self): # pylint: disable=invalid-name
@ -43,6 +43,7 @@ class TestSwitch(unittest.TestCase):
self.hass.states.get(switch.ENTITY_ID_ALL_SWITCHES).state)
self.assertTrue(switch.is_on(self.hass, self.switch_1.entity_id))
self.assertFalse(switch.is_on(self.hass, self.switch_2.entity_id))
self.assertFalse(switch.is_on(self.hass, self.switch_3.entity_id))
switch.turn_off(self.hass, self.switch_1.entity_id)
switch.turn_on(self.hass, self.switch_2.entity_id)
@ -64,6 +65,7 @@ class TestSwitch(unittest.TestCase):
self.hass.states.get(switch.ENTITY_ID_ALL_SWITCHES).state)
self.assertFalse(switch.is_on(self.hass, self.switch_1.entity_id))
self.assertFalse(switch.is_on(self.hass, self.switch_2.entity_id))
self.assertFalse(switch.is_on(self.hass, self.switch_3.entity_id))
# Turn all on
switch.turn_on(self.hass)
@ -76,6 +78,7 @@ class TestSwitch(unittest.TestCase):
self.hass.states.get(switch.ENTITY_ID_ALL_SWITCHES).state)
self.assertTrue(switch.is_on(self.hass, self.switch_1.entity_id))
self.assertTrue(switch.is_on(self.hass, self.switch_2.entity_id))
self.assertTrue(switch.is_on(self.hass, self.switch_3.entity_id))
def test_setup(self):
# Bogus config