authenticated_client = <rest_framework.test.APIClient object at 0x7f0a4fbfe898>
deposit_collection = <DepositCollection: {'id': 114, 'name': 'test'}>
partial_deposit = <Deposit: {'id': 87, 'type': 'code', 'status': 'partial', 'reception_date': datetime.datetime(2022, 4, 7, 12, 39, 9, 3...nal_id': 'some-external-id', 'origin_url': 'https://hal-test.archives-ouvertes.fr/some-external-id', 'client': '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', ...}
def test_read_metadata_revision_with_parent(
authenticated_client, deposit_collection, partial_deposit, atom_dataset
):
"""Private read metadata to a deposit (with parent) returns metadata
"""
deposit = partial_deposit
deposit.external_id = "some-external-id"
deposit.origin_url = f"https://hal-test.archives-ouvertes.fr/{deposit.external_id}"
deposit.save()
metadata_xml_raw = atom_dataset["entry-data2"]
deposit = update_deposit_with_metadata(
authenticated_client, deposit_collection, deposit, metadata_xml_raw,
)
rev_id = "da78a9d4cf1d5d29873693fd496142e3a18c20fa"
swhid = "swh:1:rev:%s" % rev_id
fake_parent = Deposit(
swhid=swhid, client=deposit.client, collection=deposit.collection
)
fake_parent.save()
deposit.parent = fake_parent
deposit.save()
for url in private_get_raw_url_endpoints(deposit_collection, deposit):
response = authenticated_client.get(url)
assert response.status_code == status.HTTP_200_OK
assert response["content-type"] == "application/json"
actual_data = response.json()
> assert actual_data == {
"origin": {
"type": "deposit",
"url": "https://hal-test.archives-ouvertes.fr/some-external-id",
},
"metadata_raw": metadata_xml_raw,
"provider": {
"metadata": {},
"provider_name": "",
"provider_type": "deposit_client",
"provider_url": "https://hal-test.archives-ouvertes.fr/",
},
"tool": {
"configuration": {"sword_version": "2"},
"name": "swh-deposit",
"version": __version__,
},
"deposit": {
"author": SWH_PERSON,
"committer": SWH_PERSON,
"committer_date": {
"offset": 0,
"timestamp": {"microseconds": 0, "seconds": 1507389428},
},
"author_date": {
"offset": 0,
"timestamp": {"microseconds": 0, "seconds": 1507389428},
},
"client": "test",
"id": deposit.id,
"collection": "test",
"revision_parents": [rev_id],
"release_notes": "This is the release of October 7th, 2017.",
},
}
E assert {'deposit': {...ntry>\n', ...} == {'deposit': {...es.fr/'}, ...}
E Omitting 4 identical items, use -vv to show
E Left contains 1 more item:
E {'raw_metadata': '<?xml version="1.0"?>\n'
E '<entry xmlns="http://www.w3.org/2005/Atom"\n'
E ' '
E 'xmlns:codemeta="https://doi.org/10.5063/SCHEMA/CODEMETA-2.0"\n'
E ' '...
E
E ...Full output truncated (110 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_private_read_metadata.py:126: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Apr 7 2022, 2:41 PM