Пример #1
0
	def delete_newly_created_users(self):
		delete_time=0		
		if len(self.newly_created_user_ids) > 0:
			delRep = DeleteRecipient(self.config, self.batch_size)
			delete_time = delRep.delete(self.newly_created_user_ids)
			# clear the entire list
			del self.newly_created_user_ids[:]
		else:
			pass
		return delete_time
Пример #2
0
	def delete_alternate(self):
		# Delete alternate
		alternate_employee_id=['alternate-1']
		del_alternate = DeleteRecipient(self.config, 1)
		del_alternate.delete(alternate_employee_id, 'del_by_emp_id')
Пример #3
0
		req = invoker.WSRequest(self.cfg)
		req.send(self._to_add_xml())
		response = req.parse()		
		errors = response.get_errors()
		if len(errors)>0:
			response.print_errors()		
		return response.get_elapsed_time()

	def _to_add_xml(self):
		str_list = []		
		for num in range(self.batch_size):
			user_id = self.user_ids_to_update.pop()
			str_list.append(SINGLE_UPDATE_USER_TEMPLATE %(user_id, 'bulk-update-%d' % user_id , 'bulk-update'))
		actual_xml = UPDATE_RECIPIENT_TEMPLATE % (self.cfg['username'],self.cfg['password'], ''.join(str_list))				
		return actual_xml
	
if __name__=='__main__':
	cfg = invoker.read_config(sys.argv[1])
	batch_size = int(sys.argv[2])
	users_to_update = int(sys.argv[3])

	r = Recipient(cfg, batch_size)
	r.create_all(users_to_update)
	user_ids_to_update = r.get_user_ids()
	print user_ids_to_update

	ur = UpdateRecipient(cfg, batch_size)
	ur.update(user_ids_to_update)

	delRep = DeleteRecipient(cfg, batch_size)
	delRep.delete(user_ids_to_update)