Given a celery job, what is the easiest way to mock a function using autospec?
For example, in python Python 2.7.5 this code will go fine:
from mock import create_autospec
from celery import task
@task
def function(a, b, c):
pass
mock_function = create_autospec(function)
mock_function.delay('wrong arguments')
When it should throw an exception because the celery "delay" method will accept any parameter.
source
share