Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.deposit.tests.api.test_deposit_update::test_put_update_metadata_done_deposit_nominal
Failed

TEST RESULT

Run At
Nov 20 2020, 3:55 PM
Details
tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_put_update_metadata_done_0' authenticated_client = <rest_framework.test.APIClient object at 0x7f2d3c041d68> complete_deposit = <Deposit: {'id': 85, 'reception_date': datetime.datetime(2020, 11, 20, 14, 55, 11, 215850, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-complete', 'client': 'test', 'status': 'done'}> deposit_collection = <DepositCollection: {'id': 105, 'name': 'test'}> atom_dataset = {'codemeta-sample': '<?xml version="1.0"?>\n <entry xmlns="http://www.w3.org/2005/Atom"\n xmlns:d...ntry>\n', 'entry-data-empty-body': '<?xml version="1.0"?>\n<entry xmlns="http://www.w3.org/2005/Atom"></entry>\n', ...} sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7f2d3c02f0f0> swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f2d3c93ac50> def test_put_update_metadata_done_deposit_nominal( tmp_path, authenticated_client, complete_deposit, deposit_collection, atom_dataset, sample_data, swh_storage, ): """Nominal scenario, client send an update of metadata on a deposit with status "done" with an existing swhid. Such swhid has its metadata updated accordingly both in the deposit backend and in the metadata storage. Response: 204 """ deposit_swhid = parse_swhid(complete_deposit.swhid) assert deposit_swhid.object_type == "directory" directory_id = hash_to_bytes(deposit_swhid.object_id) # directory targeted by the complete_deposit does not exist in the storage assert list(swh_storage.directory_missing([directory_id])) == [directory_id] # so let's create a directory reference in the storage (current deposit targets an # unknown swhid) existing_directory = sample_data.directory swh_storage.directory_add([existing_directory]) assert list(swh_storage.directory_missing([existing_directory.id])) == [] # and patch one complete deposit swhid so it targets said reference complete_deposit.swhid = swhid("directory", existing_directory.id) complete_deposit.save() actual_existing_requests_archive = DepositRequest.objects.filter( deposit=complete_deposit, type="archive" ) nb_archives = len(actual_existing_requests_archive) actual_existing_requests_metadata = DepositRequest.objects.filter( deposit=complete_deposit, type="metadata" ) nb_metadata = len(actual_existing_requests_metadata) update_uri = reverse(EDIT_IRI, args=[deposit_collection.name, complete_deposit.id]) response = authenticated_client.put( update_uri, content_type="application/atom+xml;type=entry", data=atom_dataset["entry-data1"], HTTP_X_CHECK_SWHID=complete_deposit.swhid, ) > assert response.status_code == status.HTTP_204_NO_CONTENT E assert 400 == 204 E +400 E -204 .tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_update.py:624: AssertionError