Skip to content

Commit

Permalink
tests: updated dcat and datacite tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatimah committed Apr 22, 2024
1 parent 2d55736 commit fb09b32
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,10 @@
<xsl:otherwise>
<!--
<rdf:type rdf:resource="{$foaf}Agent"/>
-->
-->
<xsl:if test="$uri != ''">
<dct:identifier rdf:datatype="{$xsd}string"><xsl:value-of select="$nameIdentifier"/></dct:identifier>
</xsl:if>
<xsl:if test="$agentName != ''">
<foaf:name><xsl:value-of select="$agentName"/></foaf:name>
</xsl:if>
Expand Down
16 changes: 14 additions & 2 deletions tests/resources/serializers/test_datacite_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def test_datacite43_serializer(running_app, full_record_to_dict):
{
"nameIdentifier": "0000-0001-8135-3489",
"nameIdentifierScheme": "ORCID",
"schemeUri": "http://orcid.org/",
}
],
"nameType": "Personal",
Expand All @@ -144,6 +145,7 @@ def test_datacite43_serializer(running_app, full_record_to_dict):
{
"nameIdentifier": "0000-0001-8135-3489",
"nameIdentifierScheme": "ORCID",
"schemeUri": "http://orcid.org/",
}
],
"nameType": "Personal",
Expand All @@ -167,6 +169,10 @@ def test_datacite43_serializer(running_app, full_record_to_dict):
"descriptionType": "Abstract",
},
{"description": "Bla bla bla", "descriptionType": "Methods", "lang": "eng"},
{
"description": '{"references": ["Nielsen et al,.."]}',
"descriptionType": "Other",
},
],
"formats": ["application/pdf"],
"fundingReferences": [
Expand Down Expand Up @@ -224,6 +230,10 @@ def test_datacite43_serializer(running_app, full_record_to_dict):
"rightsUri": "https://creativecommons.org/licenses/by/4.0/legalcode",
},
{"rights": "No rightsUri license"},
{
"rights": "Embargoed Access",
"rightsUri": "info:eu-repo/semantics/embargoedAccess",
},
],
"schemaVersion": "http://datacite.org/schema/kernel-4",
"sizes": ["11 pages"],
Expand Down Expand Up @@ -275,7 +285,7 @@ def test_datacite43_xml_serializer(running_app, full_record_to_dict):
" <givenName>Lars Holm</givenName>\n"
" <familyName>Nielsen</familyName>\n"
" <nameIdentifier "
'nameIdentifierScheme="ORCID">0000-0001-8135-3489</nameIdentifier>\n'
'nameIdentifierScheme="ORCID" schemeURI="http://orcid.org/">0000-0001-8135-3489</nameIdentifier>\n'
" <affiliation>CERN</affiliation>\n"
" <affiliation>free-text</affiliation>\n"
" </creator>\n"
Expand Down Expand Up @@ -303,7 +313,7 @@ def test_datacite43_xml_serializer(running_app, full_record_to_dict):
" <givenName>Lars Holm</givenName>\n"
" <familyName>Nielsen</familyName>\n"
" <nameIdentifier "
'nameIdentifierScheme="ORCID">0000-0001-8135-3489</nameIdentifier>\n'
'nameIdentifierScheme="ORCID" schemeURI="http://orcid.org/">0000-0001-8135-3489</nameIdentifier>\n'
" <affiliation>CERN</affiliation>\n"
" <affiliation>TU Wien</affiliation>\n"
" </contributor>\n"
Expand Down Expand Up @@ -340,12 +350,14 @@ def test_datacite43_xml_serializer(running_app, full_record_to_dict):
'rightsURI="https://creativecommons.org/licenses/by/4.0/legalcode" '
'rightsIdentifierScheme="spdx" rightsIdentifier="cc-by-4.0">Creative Commons '
"Attribution 4.0 International</rights>\n"
' <rights rightsURI="info:eu-repo/semantics/embargoedAccess">Embargoed Access</rights>\n'
" </rightsList>\n"
" <descriptions>\n"
' <description descriptionType="Abstract">A description \n'
"with HTML tags</description>\n"
' <description descriptionType="Methods" xml:lang="eng">Bla bla '
"bla</description>\n"
' <description descriptionType="Other">{"references": ["Nielsen et al,.."]}</description>\n'
" </descriptions>\n"
" <geoLocations>\n"
" <geoLocation>\n"
Expand Down
9 changes: 9 additions & 0 deletions tests/resources/serializers/test_dcat_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_dcat_serializer(running_app, full_record_to_dict):
" <dct:creator>\n"
' <rdf:Description rdf:about="https://orcid.org/0000-0001-8135-3489">\n'
' <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>\n'
' <dct:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0000-0001-8135-3489</dct:identifier>\n'
" <foaf:name>Nielsen, Lars Holm</foaf:name>\n"
" <foaf:givenName>Lars Holm</foaf:givenName>\n"
" <foaf:familyName>Nielsen</foaf:familyName>\n"
Expand Down Expand Up @@ -107,6 +108,7 @@ def test_dcat_serializer(running_app, full_record_to_dict):
" <dct:contributor>\n"
' <rdf:Description rdf:about="https://orcid.org/0000-0001-8135-3489">\n'
' <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>\n'
' <dct:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0000-0001-8135-3489</dct:identifier>\n'
" <foaf:name>Nielsen, Lars Holm</foaf:name>\n"
" <foaf:givenName>Lars Holm</foaf:givenName>\n"
" <foaf:familyName>Nielsen</foaf:familyName>\n"
Expand Down Expand Up @@ -181,6 +183,7 @@ def test_dcat_serializer(running_app, full_record_to_dict):
" <rdfs:label>Bla bla bla</rdfs:label>\n"
" </dct:ProvenanceStatement>\n"
" </dct:provenance>\n"
' <dct:description>{"references": ["Nielsen et al,.."]}</dct:description>\n'
" <dct:spatial>\n"
" <dct:Location>\n"
" <rdf:type "
Expand All @@ -199,6 +202,12 @@ def test_dcat_serializer(running_app, full_record_to_dict):
'rdf:datatype="http://www.opengis.net/ont/geosparql#geoJSONLiteral"><![CDATA[{"type":"Point","coordinates":[-32.94682,-60.63932]}]]></dcat:centroid>\n'
" </dct:Location>\n"
" </dct:spatial>\n"
' <dct:accessRights rdf:resource="http://publications.europa.eu/resource/authority/access-right/NON_PUBLIC"/>\n'
" <dct:accessRights>\n"
' <dct:RightsStatement rdf:about="info:eu-repo/semantics/embargoedAccess">\n'
" <rdfs:label>Embargoed Access</rdfs:label>\n"
" </dct:RightsStatement>\n"
" </dct:accessRights>\n"
" <dcat:distribution>\n"
" <dcat:Distribution>\n"
" <dct:extent>\n"
Expand Down

0 comments on commit fb09b32

Please sign in to comment.