authenticated_client = <rest_framework.test.APIClient object at 0x7f0a4fc82358>
deposit_collection = <DepositCollection: {'id': 115, 'name': 'test'}>
partial_deposit = <Deposit: {'id': 89, 'type': 'code', 'status': 'partial', 'reception_date': datetime.datetime(2022, 4, 7, 12, 39, 10, ..., 'external_id': 'hal-01243065', 'origin_url': 'https://hal-test.archives-ouvertes.fr/hal-01243065', '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_3(
authenticated_client, deposit_collection, partial_deposit, atom_dataset
):
"""date(Created|Published) provided, uses author/committer date
"""
deposit = partial_deposit
deposit.external_id = "hal-01243065"
deposit.origin_url = f"https://hal-test.archives-ouvertes.fr/{deposit.external_id}"
deposit.save()
metadata_xml_raw = atom_dataset["entry-data3"]
update_deposit_with_metadata(
authenticated_client, deposit_collection, deposit, metadata_xml_raw,
)
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/hal-01243065",
},
"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": 120,
"timestamp": {"microseconds": 0, "seconds": 1493820527},
},
"author_date": {
"offset": 0,
"timestamp": {"microseconds": 0, "seconds": 1507389428},
},
"client": deposit_collection.name,
"id": deposit.id,
"collection": deposit_collection.name,
"revision_parents": [],
"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 (92 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_private_read_metadata.py:185: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Apr 7 2022, 2:41 PM