swhid = 'swh:1:rev:71b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo'
authenticated_client = <rest_framework.test.APIClient object at 0x7f0bf7fd4940>
deposit_collection = <DepositCollection: {'id': 45, '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', ...}
swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f0bf7fd40b8>
@pytest.mark.parametrize(
"swhid",
[
"swh:1:cnt:01b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:dir:11b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:rev:21b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:rel:31b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:snp:41b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:cnt:51b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
"swh:1:dir:c4993c872593e960dc84e4430dbbfbc34fd706d0;origin=https://inria.halpreprod.archives-ouvertes.fr/hal-01243573;visit=swh:1:snp:0175049fc45055a3824a1675ac06e3711619a55a;anchor=swh:1:rev:b5f505b005435fa5c4fa4c279792bd7b17167c04;path=/", # noqa
"swh:1:rev:71b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
"swh:1:rel:81b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
"swh:1:snp:91b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
],
)
def test_deposit_metadata_swhid(
swhid,
authenticated_client,
deposit_collection,
atom_dataset,
swh_storage,
):
"""Posting a swhid reference is stored on raw extrinsic metadata storage"""
swhid_reference = QualifiedSWHID.from_string(swhid)
swhid_target = extended_swhid_from_qualified(swhid_reference)
xml_data = atom_dataset["entry-data-with-swhid"].format(
swhid=swhid,
metadata_provenance_url="https://hal-test.archives-ouvertes.fr/hal-abcdefgh",
)
deposit_client = authenticated_client.deposit_client
> _insert_object(swh_storage, swhid_reference)
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_collection_post_atom.py:584:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_collection_post_atom.py:70: in _insert_object
obj = strategy().example()
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:336: in example
example_generating_inner_function()
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:325: in example_generating_inner_function
@settings(
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:910: in from_dict
committer_date = TimestampWithTimezone.from_dict(committer_date)
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:443: in from_dict
timestamp = Timestamp(seconds=seconds, microseconds=microseconds)
<attrs generated init swh.model.model.Timestamp>:7: in __init__
__attr_validator_microseconds(self, __attr_microseconds, self.microseconds)
.tox/py3/lib/python3.7/site-packages/attr/_make.py:3096: in __call__
v(inst, attr, value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Timestamp(seconds=-42072, microseconds=1000000)
attribute = Attribute(name='microseconds', default=NOTHING, validator=_AndValidator(_validators=(<function type_validator.<locals>...t=True, metadata=mappingproxy({}), type=<class 'int'>, converter=None, kw_only=False, inherited=False, on_setattr=None)
value = 1000000
@microseconds.validator
def check_microseconds(self, attribute, value):
"""Checks that microseconds are positive and < 1000000."""
if not (0 <= value < 10**6):
> raise ValueError("Microseconds must be in [0, 1000000[.")
E ValueError: Microseconds must be in [0, 1000000[.
.tox/py3/lib/python3.7/site-packages/swh/model/model.py:387: ValueError
TEST RESULT
TEST RESULT
- Run At
- Jul 19 2022, 1:29 PM