From f9d8f2531535f6adc64a7d2275c5903bfd0b770a Mon Sep 17 00:00:00 2001 From: Dhwani Patel Date: Thu, 6 Feb 2025 06:20:53 -0600 Subject: [PATCH] Add suggested changes --- features/black_box/validation.feature | 4 ++-- features/steps/black_box_steps.py | 18 +++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/features/black_box/validation.feature b/features/black_box/validation.feature index 4b9822a..1b7a82e 100644 --- a/features/black_box/validation.feature +++ b/features/black_box/validation.feature @@ -6,6 +6,6 @@ Feature: Alma wants to ensure that JHOVE validation in Archivematica works corre When the transfer compliance is verified Then the "Identify file format" microservice completes successfully And the "Validate formats" job fails - And 16 "Validate formats" tasks were executed + And 17 "Validate formats" tasks were executed And 8 "Validate formats" tasks failed - And 8 "Validate formats" were successful + And 9 "Validate formats" tasks succeeded diff --git a/features/steps/black_box_steps.py b/features/steps/black_box_steps.py index c4aa3fa..8c87f2b 100644 --- a/features/steps/black_box_steps.py +++ b/features/steps/black_box_steps.py @@ -6,7 +6,6 @@ """ import os -from typing import Optional import metsrw from behave import given @@ -1530,18 +1529,15 @@ def step(context): assert uses_order_indexes == sorted(uses_order_indexes), error -@then('{task_count} "{job_name}" tasks were executed') -def step_impl(context, task_count: Optional[int] = None, job_name: str = "") -> None: +@then('{task_count:d} "{job_name}" tasks were executed') +def step_impl(context, task_count, job_name): unit_uuid = context.current_transfer["transfer_uuid"] jobs = utils.get_jobs(context.api_clients_config, unit_uuid, job_name=job_name) assert len(jobs), f"No jobs found for unit {unit_uuid}" - if task_count is None: - assert int(task_count) == 0 - else: - assert len(jobs[0]["tasks"]) == int(task_count) + assert len(jobs[0]["tasks"]) == task_count -@then('{task_count} "{job_name}" tasks failed') +@then('{task_count:d} "{job_name}" tasks failed') def step_impl(context, job_name, task_count): unit_uuid = context.current_transfer["transfer_uuid"] jobs = utils.get_jobs(context.api_clients_config, unit_uuid, job_name=job_name) @@ -1552,10 +1548,10 @@ def step_impl(context, job_name, task_count): for task in job["tasks"]: if task["exit_code"] == 1: fail_task += 1 - assert fail_task == int(task_count) + assert fail_task == task_count -@then('{task_count} "{job_name}" were successful') +@then('{task_count:d} "{job_name}" tasks succeeded') def step_impl(context, job_name, task_count): unit_uuid = context.current_transfer["transfer_uuid"] jobs = utils.get_jobs(context.api_clients_config, unit_uuid, job_name=job_name) @@ -1566,4 +1562,4 @@ def step_impl(context, job_name, task_count): for task in job["tasks"]: if task["exit_code"] == 0: success_task += 1 - assert success_task == int(task_count) + assert success_task == task_count