slug = '778e969d-077b-4053-8125-6afb8273b3f5'
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",
metadata_provenance_url="meta-prov-url",
)
actual_metadata = parse_xml(actual_metadata_xml)
assert (
actual_metadata.findtext("atom:author", namespaces=NAMESPACES)
== "deposit-client"
)
assert (
actual_metadata.findtext("atom:title", namespaces=NAMESPACES) == "project-name"
)
assert actual_metadata.findtext("atom:updated", namespaces=NAMESPACES) is not None
assert (
actual_metadata.findtext("codemeta:name", namespaces=NAMESPACES)
== "project-name"
)
assert (
actual_metadata.findtext("codemeta:identifier", namespaces=NAMESPACES)
== "external-id"
)
authors = actual_metadata.findall(
"codemeta:author/codemeta:name", namespaces=NAMESPACES
)
assert len(authors) == 2
assert authors[0].text == "some"
assert authors[1].text == "authors"
assert (
actual_metadata.find(
"swh:deposit/swh:create_origin/swh:origin", namespaces=NAMESPACES
).attrib["url"]
== "origin-url"
)
assert (
actual_metadata.findtext(
"swh:deposit/swh:metadata-provenance/schema:url", namespaces=NAMESPACES
)
== "meta-prov-url"
)
checks_ok, detail = check_metadata(ElementTree.fromstring(actual_metadata_xml))
> assert checks_ok is True
E assert False is True
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/cli/test_client.py:225: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Mar 8 2022, 5:50 PM