From 1119bb2b6ccb7bf07d65e6df46e42b58088c3935 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Wed, 11 Mar 2020 12:35:37 -0400 Subject: [PATCH] Tests that task counts and events are logged. --- tests/test_tasks_api.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_tasks_api.py b/tests/test_tasks_api.py index fabe6d98..9676a9a2 100644 --- a/tests/test_tasks_api.py +++ b/tests/test_tasks_api.py @@ -7,6 +7,7 @@ from crc.models.file import FileModelSchema from crc.models.study import StudyModel from crc.models.workflow import WorkflowSpecModelSchema, WorkflowModel, WorkflowStatus from crc.services.workflow_processor import WorkflowProcessor +from crc.models.stats import WorkflowStatsModel, TaskEventModel from tests.base_test import BaseTest @@ -40,6 +41,19 @@ class TestTasksApi(BaseTest): data=json.dumps(dict_data)) self.assert_success(rv) json_data = json.loads(rv.get_data(as_text=True)) + + num_stats = session.query(WorkflowStatsModel)\ + .filter_by(workflow_id=workflow.id)\ + .filter_by(workflow_spec_id=workflow.workflow_spec_id)\ + .count() + self.assertGreater(num_stats, 0) + + num_task_events = session.query(TaskEventModel)\ + .filter_by(workflow_id=workflow.id)\ + .filter_by(task_id=task.id)\ + .count() + self.assertGreater(num_task_events, 0) + workflow = WorkflowApiSchema().load(json_data) return workflow