Ejemplo n.º 1
0
 def test_response(self):
     result = run_async_task.delay(site=frappe.local.site,
                                   user='******',
                                   cmd='async_ping',
                                   form_dict=frappe._dict())
     result = result.get()
     self.assertEquals(result.get("message"), "pong")
Ejemplo n.º 2
0
	def _run(args, set_in_response=True):
		from frappe.tasks import run_async_task
		from frappe.handler import execute_cmd
		if frappe.conf.disable_async:
			return execute_cmd(cmd, from_async=True)
		args = frappe._dict(args)
		task = run_async_task.delay(frappe.local.site,
			(frappe.session and frappe.session.user) or 'Administrator', cmd, args)
		if set_in_response:
			frappe.local.response['task_id'] = task.id
		return task.id
Ejemplo n.º 3
0
 def queue(*args, **kwargs):
     from frappe.tasks import run_async_task
     from frappe.handler import execute_cmd
     if frappe.conf.disable_async:
         return execute_cmd(cmd, from_async=True)
     task = run_async_task.delay(frappe.local.site,
                                 (frappe.session and frappe.session.user)
                                 or 'Administrator', cmd,
                                 frappe.local.form_dict)
     frappe.local.response['task_id'] = task.id
     return {"status": "queued", "task_id": task.id}
Ejemplo n.º 4
0
	def queue(*args, **kwargs):
		from frappe.tasks import run_async_task
		from frappe.handler import execute_cmd
		if frappe.conf.disable_async:
			return execute_cmd(cmd, from_async=True)
		task = run_async_task.delay(frappe.local.site,
			(frappe.session and frappe.session.user) or 'Administrator', cmd,
				frappe.local.form_dict)
		frappe.local.response['task_id'] = task.id
		return {
			"status": "queued",
			"task_id": task.id
		}
Ejemplo n.º 5
0
    def run(args, set_in_response=True):
        from frappe.tasks import run_async_task
        from frappe.handler import execute_cmd

        if frappe.conf.disable_async:
            return execute_cmd(cmd, from_async=True)
        args = frappe._dict(args)
        task = run_async_task.delay(
            site=frappe.local.site,
            user=(frappe.session and frappe.session.user) or "Administrator",
            cmd=cmd,
            form_dict=args,
        )
        if set_in_response:
            frappe.local.response["task_id"] = task.id
        return task.id
Ejemplo n.º 6
0
	def test_response(self):
		result = run_async_task.delay(site=frappe.local.site, user='******', cmd='async_ping',
			form_dict=frappe._dict())
		result = result.get()
		self.assertEquals(result.get("message"), "pong")
Ejemplo n.º 7
0
 def test_response(self):
     result = run_async_task.delay(frappe.local.site, "Administrator", "async_ping", frappe._dict())
     result = result.get()
     self.assertEquals(result.get("message"), "pong")