For a very long time now I've been using task queues on AppEngine to schedule tasks, just the way I'm supposed to.
But what I've always been wondering is how does one write tests for that? Until now I've simply made tests to make sure an error doesn't occur on the API that queues a task and then wrote the more proper tests for the API executing the task.
However lately I've started feeling a bit unsatisfied by this and I'm searching for a way to actually test that the correct task has been added to the correct queue. Hopefully this can be done better than simply by deploying the code and hoping for the best.
I'm using django-nonrel, if that has any bearing on the answer.
To recap: How can a unit test be written to confirm tasks have been queued?
self.get_tasks
andtask['decoded_body']
as a shortcut if you're using all the base test cases (github.com/jgeewax/gaetestbed/blob/master/gaetestbed/…). Additionally, this hopefully be a part of google.appengine.ext.testbed soon. There's aget_filtered_tasks
method which works a lot likeget_tasks
(code.google.com/p/googleappengine/source/browse/trunk/python/…) – Hottempered