def test_defer(app): name = "task name" args = (1, 2) kwargs = {"kw": "keyword argument"} defer(name, *args, **kwargs) app.send_task.assert_called_once_with(name, args, kwargs, routing_key="transient.deferred")
def test_defer(): # settings.CELERY_ALWAYS_EAGER = True name = "task name" args = (1, 2) kwargs = {"kw": "keyword argument"} with mock.patch("taiga.deferred.app") as app: defer(name, *args, **kwargs) app.tasks[name].apply.assert_called_once_with(args, kwargs, routing_key="transient.deferred")
def test_task_invocation(): celery.app.task(name="_test_task")(lambda: 1) assert defer("_test_task").get() == 1