From 5fce7a72dbc05c8e125909c23c98653c36671cf7 Mon Sep 17 00:00:00 2001 From: Ray Liu Date: Mon, 9 Sep 2024 14:42:14 +1000 Subject: [PATCH] modify test function for new workflowrun model --- .../workflow_manager/models/workflow_run.py | 2 +- .../tests/test_create_workflow_run_state.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/workload/stateless/stacks/workflow-manager/workflow_manager/models/workflow_run.py b/lib/workload/stateless/stacks/workflow-manager/workflow_manager/models/workflow_run.py index e0f31c340..943b424c1 100644 --- a/lib/workload/stateless/stacks/workflow-manager/workflow_manager/models/workflow_run.py +++ b/lib/workload/stateless/stacks/workflow-manager/workflow_manager/models/workflow_run.py @@ -49,7 +49,7 @@ def to_dict(self): def get_all_states(self): # retrieve all states (DB records rather than a queryset) - return list(self.state_set.all()) # TODO: ensure order by timestamp ? + return list(self.states.all()) # TODO: ensure order by timestamp ? def get_latest_state(self): # retrieve all related states and get the latest one diff --git a/lib/workload/stateless/stacks/workflow-manager/workflow_manager_proc/tests/test_create_workflow_run_state.py b/lib/workload/stateless/stacks/workflow-manager/workflow_manager_proc/tests/test_create_workflow_run_state.py index 33cc9a9ca..52b278ed2 100644 --- a/lib/workload/stateless/stacks/workflow-manager/workflow_manager_proc/tests/test_create_workflow_run_state.py +++ b/lib/workload/stateless/stacks/workflow-manager/workflow_manager_proc/tests/test_create_workflow_run_state.py @@ -56,7 +56,7 @@ def test_create_wrsc_no_library(self): db_wfr: WorkflowRun = wfr_qs.first() self.assertEqual("ctTSO500-L000002", db_wfr.workflow_run_name) # We don't expect any library associations here! - self.assertEqual(0, db_wfr.libraries.count()) + self.assertEqual(0, db_wfr.get_libraries().count()) def test_create_wrsc_library(self): """ @@ -116,8 +116,8 @@ def test_create_wrsc_library(self): db_wfr: WorkflowRun = wfr_qs.first() self.assertEqual("ctTSO500-L000002", db_wfr.workflow_run_name) # We do expect 2 library associations here! - self.assertEqual(2, db_wfr.libraries.count()) - for lib in db_wfr.libraries.all(): + self.assertEqual(2, db_wfr.get_libraries().count()) + for lib in db_wfr.get_libraries().all(): self.assertTrue(lib.library_id in library_ids) def test_create_wrsc_library_exists(self): @@ -184,8 +184,8 @@ def test_create_wrsc_library_exists(self): db_wfr: WorkflowRun = wfr_qs.first() self.assertEqual("ctTSO500-L000002", db_wfr.workflow_run_name) # We do expect 2 library associations here! - self.assertEqual(2, db_wfr.libraries.count()) - for lib in db_wfr.libraries.all(): + self.assertEqual(2, db_wfr.get_libraries().count()) + for lib in db_wfr.get_libraries().all(): self.assertTrue(lib.library_id in library_ids) def test_get_last_state(self):