Skip to content

Commit

Permalink
fix CLI test depending on return job status response
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Oct 25, 2024
1 parent 5c821ca commit 5c3b294
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions tests/functional/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2280,37 +2280,36 @@ def test_job_statistics(self):
body = json.loads(text)
assert body == job.statistics

def test_job_info_wrong_status(self):
@parameterized.expand([
("results", Status.FAILED, "JobResultsFailed", True),
("statistics", Status.FAILED, "NoJobStatistics", True),
("exceptions", Status.FAILED, repr_json(["failed"], force_string=True, indent=2), False),
])
def test_job_info_status_dependant(self, operation, status, expect, expect_error):
# results/statistics must be in success status
job = self.job_store.save_job(task_id=uuid.uuid4(), process="test-process", access=Visibility.PUBLIC)
job.statistics = resources.load_example("job_statistics.json")
job.save_log(message="Some info", status=Status.ACCEPTED, errors=ValueError("failed"))
job = self.job_store.update_job(job)

for operation, status, expect in [
("results", Status.FAILED, "JobResultsFailed"),
("statistics", Status.FAILED, "404 Not Found"),
# ("exceptions", Status.SUCCEEDED, "404 Not Found"), # no error, just irrelevant or empty
]:
job.status = status
job = self.job_store.update_job(job)
lines = mocked_sub_requests(
self.app, run_command,
[
# "weaver",
operation,
"-u", self.url,
"-j", str(job.id),
"-nL",
],
trim=False,
entrypoint=weaver_cli,
only_local=True,
expect_error=True,
)
assert len(lines)
text = "".join(lines)
assert expect in text
job.status = status
job = self.job_store.update_job(job)
lines = mocked_sub_requests(
self.app, run_command,
[
# "weaver",
operation,
"-u", self.url,
"-j", str(job.id),
"-nL",
],
trim=False,
entrypoint=weaver_cli,
only_local=True,
expect_error=expect_error,
)
assert len(lines)
text = "\n".join(lines)
assert expect in text

def test_execute_remote_input(self):
"""
Expand Down

0 comments on commit 5c3b294

Please sign in to comment.