slug = '9e61f8c3-3c28-411d-a975-4cee69860c4e'
def test_cli_client_generate_metadata_ok(slug):
"""Generated metadata is well formed and pass service side metadata checks
"""
actual_metadata_xml = generate_metadata(
"deposit-client",
"project-name",
authors=["some", "authors"],
external_id="external-id",
create_origin="origin-url",
)
actual_metadata = dict(parse_xml(actual_metadata_xml))
assert actual_metadata["atom:author"] == "deposit-client"
assert actual_metadata["atom:title"] == "project-name"
assert actual_metadata["atom:updated"] is not None
assert actual_metadata["codemeta:name"] == "project-name"
assert actual_metadata["codemeta:identifier"] == "external-id"
assert actual_metadata["codemeta:author"] == [
OrderedDict([("codemeta:name", "some")]),
OrderedDict([("codemeta:name", "authors")]),
]
assert (
actual_metadata["swh:deposit"]["swh:create_origin"]["swh:origin"]["@url"]
== "origin-url"
)
checks_ok, detail = check_metadata(actual_metadata)
assert checks_ok is True
> assert detail is None
E AssertionError: assert {'metadata': [{'fields': ['swh:metadata-provenance'], 'summary': 'Suggested fields are missing'}]} is None
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:198: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 21 2022, 4:03 PM