def test_get_task_via_config(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}, ) config = pretend.stub(registry={"celery.app": celery_app}) assert tasks._get_task_from_config(config, task_func)
def test_get_task_via_config(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}, ) config = pretend.stub(registry={"celery.app": celery_app}) assert tasks._get_task_from_config(config, task_func)