def test_deposit_5_without_xmlns():
extrinsic_metadata = {
"{http://www.w3.org/2005/Atom}id": "hal-01243573",
"{http://www.w3.org/2005/Atom}author": {
"{http://www.w3.org/2005/Atom}name": "HAL",
"{http://www.w3.org/2005/Atom}email": "hal@ccsd.cnrs.fr",
},
"{http://www.w3.org/2005/Atom}client": "hal",
"{http://www.w3.org/2005/Atom}external_identifier": "hal-01243573",
"{https://doi.org/10.5063/SCHEMA/CODEMETA-2.0}url": "https://hal-test.archives-ouvertes.fr/hal-01243573",
"{https://doi.org/10.5063/SCHEMA/CODEMETA-2.0}name": "The assignment problem",
"{https://doi.org/10.5063/SCHEMA/CODEMETA-2.0}author": {
"{https://doi.org/10.5063/SCHEMA/CODEMETA-2.0}name": "Morane Gruenpeter"
},
# ...
}
original_artifacts = {}
row = {
"id": b"\x03\x98\x7f\x05n\xafE\x96\xcd \xd7\xb2\xee\x01\xc9\xb8L\xed\xdf\xa8",
"date": datetime.datetime(
2018, 1, 17, 12, 49, 30, 902891, tzinfo=datetime.timezone.utc
),
"committer_date": datetime.datetime(
2018, 1, 17, 12, 49, 30, 902891, tzinfo=datetime.timezone.utc
),
"type": "tar",
"message": b": Deposit 79 in collection hal",
"metadata": extrinsic_metadata,
}
swhid = (
"swh:1:dir:e04b2a7b8a8838da0693e9fd992a10d6fd211b50"
";origin=https://hal.archives-ouvertes.fr/hal-01243573"
";visit=swh:1:snp:c31851534c86676a040fb10f438728c90f1c9d55"
";anchor=swh:1:rev:43549ebbe70c9cdf0be1647e6319392eaa06f3a3"
";path=/"
)
deposit_rows = [
{
"deposit.id": 79,
"deposit.swh_id_context": swhid,
"deposit_request.metadata": None,
"deposit_request.date": datetime.datetime(
2018, 1, 17, 12, 49, 31, 208347, tzinfo=datetime.timezone.utc
),
"deposit_client.provider_url": "https://hal.archives-ouvertes.fr/",
"deposit_collection.name": "hal",
"auth_user.username": "hal",
},
{
"deposit.id": 79,
"deposit.swh_id_context": swhid,
"deposit_request.metadata": extrinsic_metadata,
"deposit_request.date": datetime.datetime(
2018, 1, 17, 12, 49, 30, 645576, tzinfo=datetime.timezone.utc
),
"deposit_client.provider_url": "https://hal.archives-ouvertes.fr/",
"deposit_collection.name": "hal",
"auth_user.username": "hal",
},
]
origin_url = "https://hal-test.archives-ouvertes.fr/hal-01243573"
storage = Mock()
def origin_get(urls):
assert urls == [origin_url]
return [Origin(url=origin_url)]
storage.origin_get.side_effect = origin_get
deposit_cur = get_mock_deposit_cur(deposit_rows)
> handle_row(row, storage, deposit_cur, dry_run=False)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/migrate_extrinsic_metadata/test_deposit.py:460:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/migrate_extrinsic_metadata.py:543: in handle_row
row, discovery_date, origin, storage, deposit_cur, dry_run
.tox/py3/lib/python3.7/site-packages/swh/storage/migrate_extrinsic_metadata.py:221: in handle_deposit_row
assert_origin_exists(storage, origin)
.tox/py3/lib/python3.7/site-packages/swh/storage/migrate_extrinsic_metadata.py:116: in assert_origin_exists
assert storage.origin_get([origin])[0] is not None, origin
/usr/lib/python3.7/unittest/mock.py:960: in __call__
return _mock_self._mock_call(*args, **kwargs)
/usr/lib/python3.7/unittest/mock.py:1026: in _mock_call
result = effect(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
urls = ['https://hal.archives-ouvertes.fr/hal-01243573']
def origin_get(urls):
> assert urls == [origin_url]
E AssertionError: assert ['https://hal...hal-01243573'] == ['https://hal...hal-01243573']
E At index 0 diff: 'https://hal.archives-ouvertes.fr/hal-01243573' != 'https://hal-test.archives-ouvertes.fr/hal-01243573'
E Full diff:
E - ['https://hal-test.archives-ouvertes.fr/hal-01243573']
E ? -----
E + ['https://hal.archives-ouvertes.fr/hal-01243573']
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/migrate_extrinsic_metadata/test_deposit.py:455: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Aug 26 2020, 8:09 PM