'Test if methods call the services as expected.'

def test_methods(self):

    self.hass.states.set('light.test', STATE_ON)
    self.assertTrue(light.is_on(self.hass, 'light.test'))
    self.hass.states.set('light.test', STATE_OFF)
    self.assertFalse(light.is_on(self.hass, 'light.test'))
    self.hass.states.set(light.ENTITY_ID_ALL_LIGHTS, STATE_ON)
    self.assertTrue(light.is_on(self.hass))
    self.hass.states.set(light.ENTITY_ID_ALL_LIGHTS, STATE_OFF)
    self.assertFalse(light.is_on(self.hass))
    turn_on_calls = mock_service(self.hass, light.DOMAIN, SERVICE_TURN_ON)
    light.turn_on(self.hass, entity_id='entity_id_val', transition='transition_val', brightness='brightness_val', rgb_color='rgb_color_val', xy_color='xy_color_val', profile='profile_val', color_name='color_name_val', white_value='white_val')
    self.hass.block_till_done()
    self.assertEqual(1, len(turn_on_calls))
    call = turn_on_calls[(-1)]
    self.assertEqual(light.DOMAIN, call.domain)
    self.assertEqual(SERVICE_TURN_ON, call.service)
    self.assertEqual('entity_id_val', call.data.get(ATTR_ENTITY_ID))
    self.assertEqual('transition_val', call.data.get(light.ATTR_TRANSITION))
    self.assertEqual('brightness_val', call.data.get(light.ATTR_BRIGHTNESS))
    self.assertEqual('rgb_color_val', call.data.get(light.ATTR_RGB_COLOR))
    self.assertEqual('xy_color_val', call.data.get(light.ATTR_XY_COLOR))
    self.assertEqual('profile_val', call.data.get(light.ATTR_PROFILE))
    self.assertEqual('color_name_val', call.data.get(light.ATTR_COLOR_NAME))
    self.assertEqual('white_val', call.data.get(light.ATTR_WHITE_VALUE))
    turn_off_calls = mock_service(self.hass, light.DOMAIN, SERVICE_TURN_OFF)
    light.turn_off(self.hass, entity_id='entity_id_val', transition='transition_val')
    self.hass.block_till_done()
    self.assertEqual(1, len(turn_off_calls))
    call = turn_off_calls[(-1)]
    self.assertEqual(light.DOMAIN, call.domain)
    self.assertEqual(SERVICE_TURN_OFF, call.service)
    self.assertEqual('entity_id_val', call.data[ATTR_ENTITY_ID])
    self.assertEqual('transition_val', call.data[light.ATTR_TRANSITION])
    toggle_calls = mock_service(self.hass, light.DOMAIN, SERVICE_TOGGLE)
    light.toggle(self.hass, entity_id='entity_id_val', transition='transition_val')
    self.hass.block_till_done()
    self.assertEqual(1, len(toggle_calls))
    call = toggle_calls[(-1)]
    self.assertEqual(light.DOMAIN, call.domain)
    self.assertEqual(SERVICE_TOGGLE, call.service)
    self.assertEqual('entity_id_val', call.data[ATTR_ENTITY_ID])
    self.assertEqual('transition_val', call.data[light.ATTR_TRANSITION])
