Is your feature request related to a problem? Please describe.
This issue is in connection to issue #15
The current code-base does not have a test for tasks module.
This is a Python module that has scripts defining a Celery task named task__track_task_progress that is responsible for relaying a task run request to a remote TES (Task Execution Service) API, and then tracking the progress of the task.
Within the task, there is code for creating a database client, updating the state of the task to INITIALIZING, fetching the task log, and then tracking the task progress by continuously polling the remote TES API. The task state is updated in the database as the task progresses, and finally, once the task has finished, the document in the database is updated to reflect the final state and the output logs.
Describe the solution you'd like
The test will have following test:
mocks the DbDocumentConnector and tes.HTTPClient classes and the Flask app instance.
tests whether the update_task_state and get_document methods are called with the correct arguments
test whether the upsert_fields_in_root_object method is called with the correct root and arguments after the task has finished.
tests whether the get_task method of tes.HTTPClient is called with the correct arguments and whether the state of the task is updated correctly in the database.
Additional context
The tests will be added to test folder.
Is your feature request related to a problem? Please describe. This issue is in connection to issue #15 The current code-base does not have a test for tasks module.
This is a Python module that has scripts defining a Celery task named
task__track_task_progress
that is responsible for relaying a task run request to a remote TES (Task Execution Service) API, and then tracking the progress of the task.Within the task, there is code for creating a database client, updating the state of the task to INITIALIZING, fetching the task log, and then tracking the task progress by continuously polling the remote TES API. The task state is updated in the database as the task progresses, and finally, once the task has finished, the document in the database is updated to reflect the final state and the output logs.
Describe the solution you'd like The test will have following test:
Additional context The tests will be added to test folder.