diff --git a/src/dsp_tools/resources/schema/data.xsd b/src/dsp_tools/resources/schema/data.xsd index 99fca9ab88..c6b51352fb 100644 --- a/src/dsp_tools/resources/schema/data.xsd +++ b/src/dsp_tools/resources/schema/data.xsd @@ -73,7 +73,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -131,7 +131,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -151,7 +151,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -171,7 +171,7 @@ - + @@ -180,7 +180,7 @@ - + @@ -190,7 +190,7 @@ - + @@ -200,7 +200,7 @@ - + @@ -210,7 +210,7 @@ - + @@ -220,7 +220,7 @@ - + @@ -230,7 +230,7 @@ - + @@ -240,7 +240,7 @@ - + @@ -402,7 +402,9 @@ - + + + @@ -411,7 +413,9 @@ - + + + @@ -447,7 +451,7 @@ - + @@ -461,7 +465,7 @@ - + @@ -477,7 +481,7 @@ - + @@ -491,7 +495,7 @@ - + @@ -510,7 +514,7 @@ - + @@ -527,7 +531,7 @@ - + @@ -566,11 +570,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -619,5 +658,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/test/integration/commands/excel2xml/test_excel2xml_cli.py b/test/integration/commands/excel2xml/test_excel2xml_cli.py index 643a157ac9..7e587319f6 100644 --- a/test/integration/commands/excel2xml/test_excel2xml_cli.py +++ b/test/integration/commands/excel2xml/test_excel2xml_cli.py @@ -98,7 +98,7 @@ def test_missing_resource_permission(self) -> None: file = f"{INVALID_EXCEL_DIRECTORY}/missing-resource-permissions.xlsx" expected_msg = "Missing permissions for resource 'person_0' (Excel row 2)" expected_xml_validation = regex.escape( - "Element 'resource', attribute 'permissions': " "'' is not a valid value of the atomic type 'xs:NCName'." + "Element 'resource', attribute 'permissions': " "'' is not a valid value of the atomic type 'xs:IDREF'." ) _, catched_warnings = excel2xml_cli.excel2xml(file, "1234", "excel2xml-invalid") assert len(catched_warnings) == 2 @@ -124,7 +124,7 @@ def test_missing_bitstream_permission(self) -> None: " An attempt to deduce them from the resource permissions failed." ) expected_xml_validation = regex.escape( - "Element 'bitstream', attribute 'permissions': " "'' is not a valid value of the atomic type 'xs:NCName'." + "Element 'bitstream', attribute 'permissions': " "'' is not a valid value of the atomic type 'xs:IDREF'." ) _, catched_warnings = excel2xml_cli.excel2xml(file, "1234", "excel2xml-invalid") assert len(catched_warnings) == 3 diff --git a/test/integration/utils/test_xml_validation.py b/test/integration/utils/test_xml_validation.py index 4c23ce40ff..c59705a61d 100644 --- a/test/integration/utils/test_xml_validation.py +++ b/test/integration/utils/test_xml_validation.py @@ -68,5 +68,16 @@ def test_validate_xml_empty_label() -> None: validate_xml_file(input_file="testdata/invalid-testdata/xml-data/empty-label.xml") +def test_validate_xml_duplicate_license_copyright_id() -> None: + expected_msg = regex.escape( + "The XML file cannot be uploaded due to the following validation error(s):\n" + " Line 11: Element 'copyright-attribution', attribute 'id': 'copyright_id' " + "is not a valid value of the atomic type 'xs:ID'.\n" + " Line 16: Element 'license', attribute 'id': 'license_id' is not a valid value of the atomic type 'xs:ID'." + ) + with pytest.raises(InputError, match=expected_msg): + validate_xml_file(input_file="testdata/invalid-testdata/xml-data/duplicate-license-copyright-ids.xml") + + if __name__ == "__main__": pytest.main([__file__]) diff --git a/testdata/invalid-testdata/xml-data/duplicate-license-copyright-ids.xml b/testdata/invalid-testdata/xml-data/duplicate-license-copyright-ids.xml new file mode 100644 index 0000000000..4a3265ec15 --- /dev/null +++ b/testdata/invalid-testdata/xml-data/duplicate-license-copyright-ids.xml @@ -0,0 +1,19 @@ + + + + + + Copyright Text + Copyright Text + + + + license text + license text + + + diff --git a/testdata/xml-data/test-data-systematic.xml b/testdata/xml-data/test-data-systematic.xml index 5c5cd46820..7fe4523e20 100644 --- a/testdata/xml-data/test-data-systematic.xml +++ b/testdata/xml-data/test-data-systematic.xml @@ -29,6 +29,37 @@ M + + Copyright Text + + + + + CC BY 4.0 + + + CC BY-SA 4.0 + + + CC BY-NC 4.0 + + + CC BY-NC-SA 4.0 + + + CC BY-ND 4.0 + + + CC BY-NC-ND 4.0 + + + CC0 1.0 + + + First Line. + Second Line. + + + + https://iiif.wellcomecollection.org/image/b20432033_B0008608.JP2/full/1338%2C/0/default.jpg + + + Licence: Attribution-NonCommercial 4.0 International (CC BY-NC 4.0). + Credit: Zebrafish embryo. Source: Wellcome Collection. + + + + - testdata/bitstreams/test.tiff + testdata/bitstreams/test.tiff This is a Imagething as TIFF