def test_get_task_via_request(self): task_func = pretend.stub(__name__="task_func", __module__="tests.foo") task_obj = pretend.stub() celery_app = pretend.stub( gen_task_name=lambda func, module: module + "." + func, tasks={"tests.foo.task_func": task_obj}, ) request = pretend.stub(registry={"celery.app": celery_app}) get_task = tasks._get_task_from_request(request) assert get_task(task_func) is task_obj
def test_get_task_via_request(self): task_func = pretend.stub(__name__="task_func", __module__="tests.foo") task_obj = pretend.stub() celery_app = pretend.stub( gen_task_name=lambda func, module: module + "." + func, tasks={"tests.foo.task_func": task_obj}, ) request = pretend.stub(registry={"celery.app": celery_app}) get_task = tasks._get_task_from_request(request) assert get_task(task_func) is task_obj