Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_deposit_private_update_status.py
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | for url in private_check_url_endpoints(deposit_collection, deposit): | ||||
dir_id = persistent_identifier(DIRECTORY, directory_id) | dir_id = persistent_identifier(DIRECTORY, directory_id) | ||||
rev_id = persistent_identifier(REVISION, revision_id) | rev_id = persistent_identifier(REVISION, revision_id) | ||||
snp_id = persistent_identifier(SNAPSHOT, snapshot_id) | snp_id = persistent_identifier(SNAPSHOT, snapshot_id) | ||||
expected_swh_id = "swh:1:dir:%s" % directory_id | expected_swh_id = "swh:1:dir:%s" % directory_id | ||||
expected_swh_id_context = ( | expected_swh_id_context = ( | ||||
f"{dir_id};origin={origin_url};" + f"visit={snp_id};anchor={rev_id};path=/" | f"{dir_id};origin={origin_url};" + f"visit={snp_id};anchor={rev_id};path=/" | ||||
) | ) | ||||
expected_swh_anchor_id = rev_id | |||||
expected_swh_anchor_id_context = f"{rev_id};origin={origin_url}" | |||||
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 | ||||
deposit = Deposit.objects.get(pk=deposit.id) | deposit = Deposit.objects.get(pk=deposit.id) | ||||
assert deposit.status == expected_status | assert deposit.status == expected_status | ||||
assert deposit.swh_id == expected_swh_id | assert deposit.swh_id == expected_swh_id | ||||
assert deposit.swh_id_context == expected_swh_id_context | assert deposit.swh_id_context == expected_swh_id_context | ||||
assert deposit.swh_anchor_id == expected_swh_anchor_id | |||||
assert deposit.swh_anchor_id_context == expected_swh_anchor_id_context | |||||
# Reset deposit | # Reset deposit | ||||
deposit = ready_deposit_verified | deposit = ready_deposit_verified | ||||
deposit.save() | deposit.save() | ||||
def test_update_deposit_status_rejected_with_info( | def test_update_deposit_status_rejected_with_info( | ||||
authenticated_client, deposit_collection, ready_deposit_verified | authenticated_client, deposit_collection, ready_deposit_verified | ||||
Show All 12 Lines | for url in private_check_url_endpoints(deposit_collection, deposit): | ||||
assert response.status_code == status.HTTP_204_NO_CONTENT | assert response.status_code == status.HTTP_204_NO_CONTENT | ||||
deposit = Deposit.objects.get(pk=deposit.id) | deposit = Deposit.objects.get(pk=deposit.id) | ||||
assert deposit.status == DEPOSIT_STATUS_LOAD_FAILURE | assert deposit.status == DEPOSIT_STATUS_LOAD_FAILURE | ||||
assert deposit.swh_id is None | assert deposit.swh_id is None | ||||
assert deposit.swh_id_context is None | assert deposit.swh_id_context is None | ||||
assert deposit.swh_anchor_id is None | |||||
assert deposit.swh_anchor_id_context is None | |||||
# Reset status | # Reset status | ||||
deposit = ready_deposit_verified | deposit = ready_deposit_verified | ||||
deposit.save() | deposit.save() | ||||
def test_update_deposit_status_success_with_incomplete_data( | def test_update_deposit_status_success_with_incomplete_data( | ||||
authenticated_client, deposit_collection, ready_deposit_verified | authenticated_client, deposit_collection, ready_deposit_verified | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |