cli_runner = <click.testing.CliRunner object at 0x7f82c397b080>
complete_deposit = <Deposit: {'id': 133, 'type': 'code', 'status': 'done', 'reception_date': datetime.datetime(2022, 3, 15, 9, 8, 29, 609... 'external-id-complete', 'origin_url': 'https://hal-test.archives-ouvertes.fr/external-id-complete', 'client': 'test'}>
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f82c3fa9eb8>
def test_cli_admin_reschedule_nominal(cli_runner, complete_deposit, swh_scheduler):
"""Rescheduling deposit with no load_task_id cannot work.
"""
deposit = complete_deposit
from swh.deposit.models import Deposit
# create a task to keep a reference on it
task = create_oneshot_task_dict(
"load-deposit", url=deposit.origin_url, deposit_id=deposit.id, retries_left=3
)
scheduled_task = swh_scheduler.create_tasks([task])[0]
# disable it
swh_scheduler.set_status_tasks([scheduled_task["id"]], status="disabled")
# Now update the deposit state with some swhid and relevant load_task_id
deposit = complete_deposit
deposit.load_task_id = scheduled_task["id"]
deposit.swhid = "swh:1:dir:02ed6084fb0e8384ac58980e07548a547431cf74"
deposit.swhid_context = f"{deposit.swhid};origin=https://url/external-id"
deposit.save()
# Reschedule it
result = cli_runner.invoke(
cli, ["deposit", "reschedule", "--deposit-id", deposit.id]
)
> assert result.exit_code == 0
E assert 1 == 0
E +1
E -0
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_admin.py:307: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Mar 15 2022, 10:10 AM