authenticated_client = <rest_framework.test.APIClient object at 0x7f7503a99828>
deposit_collection = <DepositCollection: {'id': 66, 'name': 'test'}>
sample_archive = {'data': b'PK\x03\x04\x14\x00\x00\x00\x00\x00\x07c\xa4P\xcba\xb4c\x14\x00\x00\x00\x14\x00\x00\x00\x05\x00\x00\x00file1...ytest-0/test_add_deposit_schedules_che0/tmpc_nrbm5h', 'length': 128, 'md5sum': '93e8d45d31f8ac648e0f437a396a20f0', ...}
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f7503aa5e48>
def test_add_deposit_schedules_check(
authenticated_client, deposit_collection, sample_archive, swh_scheduler
):
"""Posting deposit on collection creates a checker task
"""
external_id = "external-id-schedules-check"
url = reverse(COL_IRI, args=[deposit_collection.name])
timestamp_before_call = now()
response = authenticated_client.post(
url,
content_type="application/zip", # as zip
data=sample_archive["data"],
# + headers
CONTENT_LENGTH=sample_archive["length"],
HTTP_SLUG=external_id,
HTTP_CONTENT_MD5=sample_archive["md5sum"],
HTTP_PACKAGING="http://purl.org/net/sword/package/SimpleZip",
HTTP_IN_PROGRESS="false",
HTTP_CONTENT_DISPOSITION="attachment; filename=%s" % (sample_archive["name"]),
)
timestamp_after_call = now()
assert response.status_code == status.HTTP_201_CREATED
assert b"<deposit_status>deposited</deposit_status>" in response.content
tasks = swh_scheduler.grab_ready_tasks("check-deposit")
assert len(tasks) == 1
task = tasks[0]
assert timestamp_before_call <= task.pop("next_run") <= timestamp_after_call
> assert task == {
"arguments": {
"args": [],
"kwargs": {
"deposit_check_url": "http://testserver/1/private/test/1/check/",
},
},
"current_interval": datetime.timedelta(days=1),
"id": 1,
"policy": "oneshot",
"priority": None,
"retries_left": 3,
"status": "next_run_scheduled",
"type": "check-deposit",
}
E AssertionError: assert RealDictRow([...rity', None)]) == {'arguments':...oneshot', ...}
E Omitting 7 identical items, use -vv to show
E Differing items:
E {'arguments': {'args': [], 'kwargs': {'deposit_check_url': 'http://testserver/1/private/test/53/check/'}}} != {'arguments': {'args': [], 'kwargs': {'deposit_check_url': 'http://testserver/1/private/test/1/check/'}}}
E Full diff:
E - {
E - 'arguments': {'args': [],
E + RealDictRow([('id',...
E
E ...Full output truncated (29 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_schedule.py:70: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 4 2020, 2:24 PM