'Test vacuum services.'

def test_services(self):

    send_command_calls = mock_service(self.hass, DOMAIN, SERVICE_SEND_COMMAND)
    params = {'rotate': 150, 'speed': 20}
    vacuum.send_command(self.hass, 'test_command', entity_id=ENTITY_VACUUM_BASIC, params=params)
    self.hass.block_till_done()
    self.assertEqual(1, len(send_command_calls))
    call = send_command_calls[(-1)]
    self.assertEqual(DOMAIN, call.domain)
    self.assertEqual(SERVICE_SEND_COMMAND, call.service)
    self.assertEqual(ENTITY_VACUUM_BASIC, call.data[ATTR_ENTITY_ID])
    self.assertEqual('test_command', call.data[ATTR_COMMAND])
    self.assertEqual(params, call.data[ATTR_PARAMS])
    set_fan_speed_calls = mock_service(self.hass, DOMAIN, SERVICE_SET_FAN_SPEED)
    vacuum.set_fan_speed(self.hass, FAN_SPEEDS[0], entity_id=ENTITY_VACUUM_COMPLETE)
    self.hass.block_till_done()
    self.assertEqual(1, len(set_fan_speed_calls))
    call = set_fan_speed_calls[(-1)]
    self.assertEqual(DOMAIN, call.domain)
    self.assertEqual(SERVICE_SET_FAN_SPEED, call.service)
    self.assertEqual(ENTITY_VACUUM_COMPLETE, call.data[ATTR_ENTITY_ID])
    self.assertEqual(FAN_SPEEDS[0], call.data[ATTR_FAN_SPEED])
