Skip to content

Commit

Permalink
Add suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhwaniartefact committed Feb 6, 2025
1 parent a9ad749 commit f9d8f25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions features/black_box/validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 7 additions & 11 deletions features/steps/black_box_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""

import os
from typing import Optional

import metsrw
from behave import given
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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

0 comments on commit f9d8f25

Please sign in to comment.