Unit tests for #318. Closes #318

This commit enables users to easily flush all the tasks from an application.