Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_deposit_schedule.py
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | ): | ||||
assert actual_state == DEPOSIT_STATUS_DEPOSITED | assert actual_state == DEPOSIT_STATUS_DEPOSITED | ||||
deposit_id = response_content["deposit_id"] | deposit_id = response_content["deposit_id"] | ||||
tasks = swh_scheduler.grab_ready_tasks("check-deposit") | tasks = swh_scheduler.grab_ready_tasks("check-deposit") | ||||
assert len(tasks) == 1 | assert len(tasks) == 1 | ||||
task = tasks[0] | task = tasks[0] | ||||
assert timestamp_before_call <= task.pop("next_run") <= timestamp_after_call | assert timestamp_before_call <= task.pop("next_run") <= timestamp_after_call | ||||
check_url = f"http://testserver/1/private/test/{deposit_id}/check/" | |||||
assert task == { | assert task == { | ||||
"arguments": {"args": [], "kwargs": {"deposit_check_url": check_url,},}, | "arguments": { | ||||
"args": [], | |||||
"kwargs": {"collection": "test", "deposit_id": int(deposit_id),}, | |||||
}, | |||||
"current_interval": datetime.timedelta(days=1), | "current_interval": datetime.timedelta(days=1), | ||||
"id": 1, | "id": 1, | ||||
"policy": "oneshot", | "policy": "oneshot", | ||||
"priority": None, | "priority": None, | ||||
"retries_left": 3, | "retries_left": 3, | ||||
"status": "next_run_scheduled", | "status": "next_run_scheduled", | ||||
"type": "check-deposit", | "type": "check-deposit", | ||||
} | } |