I have a AppEngine application that exposes some APIs. Right now I'm writing tests for those APIs but some of them enqueue tasks. I'm not sure how I can write a test case that waits for all the tasks that certain API call enqueued to finish.
Any ideas how within a test itself I can verify that certain tasks have finished?
I assume you are using testbed.
Within testbed, enqueued tasks sit there until you execute them yourself. Since the test environment is single threaded, you manually execute the tasks in the queue and you know exactly when they are done.
This answer shows you how to manually execute tasks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With