Add unit tests for all the Celery worker tasks.
Review Request #11534 — Created March 18, 2021 and submitted — Latest diff uploaded
These tests cover the
RunToolandupdate_tools_listtasks, with all
possible success and error conditions, helping ensure we don't break
this code path as we iterate on code.Celery tasks can be somewhat tricky to test, as there isn't a standard
way of doing this, but in our case it's not too difficult. For
RunTool, We just needed to hijack part of the process to inject a
customdelivery_infowith the routing key that maps to the tool to
run.These tests work on Celery 3.x (Python 2.7) and 4.x (Python 3).
Since much of these task code paths involve talking to the API, this
change also provides a bunch of stubbed-out resources that either do
nothing or chain to other resoureces that we can spy on.
Unit tests pass for Python 2.7 and 3.x, on Celery 3.x and 4.x.