Skip to content

Commit f12aa1b

Browse files
committed
Add current_step and can_start to RunSerializer
Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
1 parent 237ea33 commit f12aa1b

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎scanpipe/api/serializers.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,13 @@ class Meta:
130130
"task_exitcode",
131131
"task_output",
132132
"log",
133+
"current_step",
133134
"execution_time",
135+
"can_start",
136+
]
137+
read_only_fields = [
138+
"current_step",
139+
"can_start",
134140
]
135141

136142

‎scanpipe/tests/test_api.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,15 @@ def test_scanpipe_api_run_detail(self):
11831183
self.assertEqual("", response.data["task_output"])
11841184
self.assertIsNone(response.data["execution_time"])
11851185
self.assertEqual(Run.Status.NOT_STARTED, response.data["status"])
1186+
self.assertEqual("", response.data["current_step"])
1187+
self.assertTrue(response.data["can_start"])
1188+
1189+
run1.set_task_started(run1.pk)
1190+
run1.set_current_step("extract_archives")
1191+
response = self.csrf_client.get(url)
1192+
self.assertEqual(Run.Status.RUNNING, response.data["status"])
1193+
self.assertEqual("extract_archives", response.data["current_step"])
1194+
self.assertFalse(response.data["can_start"])
11861195

11871196
@mock.patch("scanpipe.models.Run.execute_task_async")
11881197
def test_scanpipe_api_run_action_start_pipeline(self, mock_execute_task):

0 commit comments

Comments
 (0)