swhid = 'swh:1:rev:21b5c8cc985d190b5a7ef4878128ebfdc2358f49'
target_type = <MetadataTargetType.REVISION: 'revision'>
authenticated_client = <rest_framework.test.APIClient object at 0x7f2d3cf48f28>
deposit_collection = <DepositCollection: {'id': 33, '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 0x7f2d3d04f7f0>
@pytest.mark.parametrize(
"swhid,target_type",
[
(
"swh:1:cnt:01b5c8cc985d190b5a7ef4878128ebfdc2358f49",
MetadataTargetType.CONTENT,
),
(
"swh:1:dir:11b5c8cc985d190b5a7ef4878128ebfdc2358f49",
MetadataTargetType.DIRECTORY,
),
(
"swh:1:rev:21b5c8cc985d190b5a7ef4878128ebfdc2358f49",
MetadataTargetType.REVISION,
),
(
"swh:1:rel:31b5c8cc985d190b5a7ef4878128ebfdc2358f49",
MetadataTargetType.RELEASE,
),
(
"swh:1:snp:41b5c8cc985d190b5a7ef4878128ebfdc2358f49",
MetadataTargetType.SNAPSHOT,
),
(
"swh:1:cnt:51b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
MetadataTargetType.CONTENT,
),
(
"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
MetadataTargetType.DIRECTORY,
),
(
"swh:1:rev:71b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
MetadataTargetType.REVISION,
),
(
"swh:1:rel:81b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
MetadataTargetType.RELEASE,
),
(
"swh:1:snp:91b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
MetadataTargetType.SNAPSHOT,
),
],
)
def test_deposit_metadata_swhid(
swhid,
target_type,
authenticated_client,
deposit_collection,
atom_dataset,
swh_storage,
):
"""Posting a swhid reference is stored on raw extrinsic metadata storage
"""
swhid_reference = parse_swhid(swhid)
swhid_core = attr.evolve(swhid_reference, metadata={})
xml_data = atom_dataset["entry-data-with-swhid"].format(swhid=swhid)
deposit_client = authenticated_client.deposit_client
response = authenticated_client.post(
reverse(COL_IRI, args=[deposit_collection.name]),
content_type="application/atom+xml;type=entry",
data=xml_data,
)
> assert response.status_code == status.HTTP_201_CREATED
E assert 400 == 201
E +400
E -201
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_collection_post_metadata.py:136: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 20 2020, 3:55 PM