Re: [BangPypers] Django - Testing Celery Tasks!

2014-08-06 Thread Pradip Caulagi
On Wednesday 06 August 2014 12:17 PM, Anand Reddy Pandikunta wrote: Hi, Here is one simple model and a celery task. Can some one tell me how to write a test for this task? Thank you! *my_app/models.py* *class MyModel(models.Model):* *x = models.IntegerField()* *y = models.IntegerField()

Re: [BangPypers] Django - Testing Celery Tasks!

2014-08-06 Thread kracekumar ramaraju
Hi This is how I solve it. tasks.py @app.task def some_task(*args, **kwargs): return do_something(*args, **kwargs) somefile.py def do_something(*args, **kwargs): # All my logic is here test_somefile.py def test_do_something_when_user_isinactive(): #test logic, this works in py.

[BangPypers] Django - Testing Celery Tasks!

2014-08-05 Thread Anand Reddy Pandikunta
Hi, Here is one simple model and a celery task. Can some one tell me how to write a test for this task? Thank you! *my_app/models.py* *class MyModel(models.Model):* *x = models.IntegerField()* *y = models.IntegerField()* *sum = models.IntegerField()* *my_app/tests/test_tasks.py* *@ce