Skip to content

Commit

Permalink
Check updating task stage after changing job state (#8061)
Browse files Browse the repository at this point in the history
  • Loading branch information
novda authored Jul 2, 2024
1 parent 688e0c5 commit 84dde61
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/python/rest_api/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,26 @@ def test_can_remove_owner_and_fetch_with_sdk(self, admin_user, tasks):
source_task["owner"] = None
assert DeepDiff(source_task, fetched_task, ignore_order=True) == {}

@pytest.mark.usefixtures("restore_db_per_function")
def test_check_task_status_after_changing_job_state(self, admin_user, tasks, jobs):
task = next(t for t in tasks if t["jobs"]["count"] == 1 if t["jobs"]["completed"] == 0)
job = next(j for j in jobs if j["task_id"] == task["id"])

with make_api_client(admin_user) as api_client:
api_client.jobs_api.partial_update(
job["id"],
patched_job_write_request=models.PatchedJobWriteRequest(stage="acceptance"),
)

api_client.jobs_api.partial_update(
job["id"],
patched_job_write_request=models.PatchedJobWriteRequest(state="completed"),
)

(server_task, _) = api_client.tasks_api.retrieve(task["id"])

assert server_task.status == "completed"


class TestListTasksFilters(CollectionSimpleFilterTestBase):
field_lookups = {
Expand Down

0 comments on commit 84dde61

Please sign in to comment.