Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_deposit_private_update_status.py
Show All 33 Lines | ): | ||||
"""Update deposit with load success should require all information to succeed | """Update deposit with load success should require all information to succeed | ||||
""" | """ | ||||
deposit = ready_deposit_verified | deposit = ready_deposit_verified | ||||
expected_status = DEPOSIT_STATUS_LOAD_SUCCESS | expected_status = DEPOSIT_STATUS_LOAD_SUCCESS | ||||
status_detail = "it works!" | status_detail = "it works!" | ||||
origin_url = "something" | origin_url = "something" | ||||
directory_id = "42a13fc721c8716ff695d0d62fc851d641f3a12b" | directory_id = "42a13fc721c8716ff695d0d62fc851d641f3a12b" | ||||
revision_id = "47dc6b4636c7f6cba0df83e3d5490bf4334d987e" | release_id = "47dc6b4636c7f6cba0df83e3d5490bf4334d987e" | ||||
snapshot_id = "68c0d26104d47e278dd6be07ed61fafb561d0d20" | snapshot_id = "68c0d26104d47e278dd6be07ed61fafb561d0d20" | ||||
full_body_info = { | full_body_info = { | ||||
"status": DEPOSIT_STATUS_LOAD_SUCCESS, | "status": DEPOSIT_STATUS_LOAD_SUCCESS, | ||||
"status_detail": status_detail, | "status_detail": status_detail, | ||||
"revision_id": revision_id, | "release_id": release_id, | ||||
"directory_id": directory_id, | "directory_id": directory_id, | ||||
"snapshot_id": snapshot_id, | "snapshot_id": snapshot_id, | ||||
"origin_url": origin_url, | "origin_url": origin_url, | ||||
} | } | ||||
for url in private_check_url_endpoints(deposit_collection, deposit): | for url in private_check_url_endpoints(deposit_collection, deposit): | ||||
expected_swhid = "swh:1:dir:%s" % directory_id | expected_swhid = "swh:1:dir:%s" % directory_id | ||||
expected_swhid_context = ( | expected_swhid_context = ( | ||||
f"{expected_swhid}" | f"{expected_swhid}" | ||||
f";origin={origin_url}" | f";origin={origin_url}" | ||||
f";visit=swh:1:snp:{snapshot_id}" | f";visit=swh:1:snp:{snapshot_id}" | ||||
f";anchor=swh:1:rev:{revision_id}" | f";anchor=swh:1:rel:{release_id}" | ||||
f";path=/" | f";path=/" | ||||
) | ) | ||||
response = authenticated_client.put( | response = authenticated_client.put( | ||||
url, content_type="application/json", data=json.dumps(full_body_info), | url, content_type="application/json", data=json.dumps(full_body_info), | ||||
) | ) | ||||
assert response.status_code == status.HTTP_204_NO_CONTENT | assert response.status_code == status.HTTP_204_NO_CONTENT | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
): | ): | ||||
"""Update deposit status with status success and incomplete information should fail | """Update deposit status with status success and incomplete information should fail | ||||
""" | """ | ||||
deposit = ready_deposit_verified | deposit = ready_deposit_verified | ||||
origin_url = "something" | origin_url = "something" | ||||
directory_id = "42a13fc721c8716ff695d0d62fc851d641f3a12b" | directory_id = "42a13fc721c8716ff695d0d62fc851d641f3a12b" | ||||
revision_id = "47dc6b4636c7f6cba0df83e3d5490bf4334d987e" | release_id = "47dc6b4636c7f6cba0df83e3d5490bf4334d987e" | ||||
snapshot_id = "68c0d26104d47e278dd6be07ed61fafb561d0d20" | snapshot_id = "68c0d26104d47e278dd6be07ed61fafb561d0d20" | ||||
new_status = DEPOSIT_STATUS_LOAD_SUCCESS | new_status = DEPOSIT_STATUS_LOAD_SUCCESS | ||||
full_body_info = { | full_body_info = { | ||||
"status": new_status, | "status": new_status, | ||||
"revision_id": revision_id, | "release_id": release_id, | ||||
"directory_id": directory_id, | "directory_id": directory_id, | ||||
"snapshot_id": snapshot_id, | "snapshot_id": snapshot_id, | ||||
"origin_url": origin_url, | "origin_url": origin_url, | ||||
} | } | ||||
for url in private_check_url_endpoints(deposit_collection, deposit): | for url in private_check_url_endpoints(deposit_collection, deposit): | ||||
for key in MANDATORY_KEYS: | for key in MANDATORY_KEYS: | ||||
# Crafting body with missing information so that it raises | # Crafting body with missing information so that it raises | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |