diff --git a/swh/deposit/tests/api/test_checks.py b/swh/deposit/tests/api/test_checks.py --- a/swh/deposit/tests/api/test_checks.py +++ b/swh/deposit/tests/api/test_checks.py @@ -38,9 +38,10 @@ """ _parameters1 = [ - textwrap.dedent(metadata_ok) - for (metadata_ok,) in [ + pytest.param(textwrap.dedent(metadata_ok), id=id_) + for (id_, metadata_ok,) in [ ( + "atom-only-with-name", f"""\ something @@ -52,6 +53,18 @@ """, ), ( + "atom-only-with-title", + f"""\ + + something + something-else + bar + someone + + """, + ), + ( + "atom-only-and-external_identifier", f"""\ something @@ -63,6 +76,7 @@ """, ), ( + "atom-and-codemeta-minimal", f"""\ some url @@ -75,6 +89,21 @@ """, ), ( + "unknown-codemeta-inner-element-after", + f"""\ + + some url + bar + + someone + should allow anything here + + {PROVENANCE_XML} + + """, + ), + ( + "unknown-schema-inner-element-after", f"""\ some url @@ -88,6 +117,7 @@ """, ), ( + "unknown-schema-inner-element-before", f"""\ some url @@ -101,6 +131,7 @@ """, ), ( + "unknown-schema-inner-element-before-and-after", f"""\ some url @@ -115,6 +146,7 @@ """, ), ( + "codemeta-dates", f"""\ some url @@ -129,6 +161,7 @@ """, ), ( + "codemeta-datetimes", # technically, only Date is allowed for datePublished; but we allow DateTime # for backward compatibility with old swh-deposit versions f"""\ @@ -145,16 +178,7 @@ """, ), ( - f"""\ - - something - something-else - bar - someone - - """, - ), - ( + "swh:add_to_origin", f"""\ something @@ -173,6 +197,7 @@ """, ), ( + "swh:reference-origin", f"""\ something @@ -191,6 +216,7 @@ """, ), ( + "swh:reference-object", f"""\ something @@ -234,9 +260,10 @@ _parameters2 = [ - (textwrap.dedent(metadata_ko), expected_summary) - for (metadata_ko, expected_summary) in [ + pytest.param(textwrap.dedent(metadata_ko), expected_summary, id=id_) + for (id_, metadata_ko, expected_summary) in [ ( + "no-name-or-title", f"""\ something @@ -251,6 +278,7 @@ }, ), ( + "no-author", f"""\ something @@ -265,6 +293,7 @@ }, ), ( + "wrong-title-namespace", f"""\ something @@ -280,6 +309,7 @@ }, ), ( + "wrong-author-namespace", f"""\ something @@ -326,9 +357,10 @@ _parameters3 = [ - (textwrap.dedent(metadata_ko), expected_summary) - for (metadata_ko, expected_summary) in [ + pytest.param(textwrap.dedent(metadata_ko), expected_summary, id=id_) + for (id_, metadata_ko, expected_summary) in [ ( + "child-element-in-name", f"""\ some url @@ -347,6 +379,7 @@ ], ), ( + "chardata-in-author", f"""\ some url @@ -363,6 +396,7 @@ ], ), ( + "author-with-no-name", f"""\ some url @@ -381,6 +415,7 @@ ], ), ( + "invalid-dates", f"""\ something @@ -404,29 +439,7 @@ ], ), ( - f"""\ - - some url - someid - bar - no one - 2020-aa-21 - 2020-12-bb - {PROVENANCE_XML} - - """, - [ - { - "summary": ".*Reason: invalid value '2020-aa-21'.*", - "fields": ["codemeta:datePublished"], - }, - { - "summary": ".*Reason: invalid value '2020-12-bb'.*", - "fields": ["codemeta:dateCreated"], - }, - ], - ), - ( + "invalid-dateModified", f"""\ some url @@ -445,6 +458,7 @@ ], ), ( + "error-and-missing-provenance", f"""\ some url @@ -464,6 +478,7 @@ ], ), ( + "unknown-tag-in-swh-namespace", f"""\ something @@ -491,6 +506,7 @@ ], ), ( + "multiple-swh:add_to_origin", f"""\ something @@ -520,6 +536,7 @@ ], ), ( + "swh:add_to_origin-and-swh:create_origin", f"""\ something @@ -551,6 +568,7 @@ ], ), ( + "swh:reference-and-swh:create_origin", f"""\ something @@ -582,6 +600,7 @@ ], ), ( + "swh:add_to_origin-and-swh:reference", f"""\ something @@ -613,6 +632,7 @@ ], ), ( + "swh:reference-two-children", f"""\ something @@ -638,6 +658,7 @@ ], ), ( + "swh:reference-two-origins", f"""\ something @@ -663,6 +684,7 @@ ], ), ( + "swh:reference-two-objects", f"""\ something @@ -671,7 +693,7 @@ someone - +