Exemple #1
0
    def test_missing_file_identifier(self):
        """
        SCENARIO:  The XML metadata file has an empty file identifier field.

        EXPECTED RESULT:  MissingMetadataFileIdentifierError is raised.
        """
        package = 'tests.data.nkn.60795440-42b0-4fb2-a2d4-7e7c00c66aa1'
        content = ir.read_binary(package, 'metadata.xml')
        doc = lxml.etree.parse(io.BytesIO(content))

        harvester = NKNHarvester()

        with self.assertRaises(MissingMetadataFileIdentifierError):
            harvester.extract_series_identifier(doc)
Exemple #2
0
    def test_identifier(self, mock_logger):
        """
        SCENARIO:  The NKN identifier is a UUID that must be retrieved from
        the metadata XML document.

        EXPECTED RESULT:  0a42d2bc-700a-4cf2-a7ac-ad6b892da7f0
        """
        package = 'tests.data.nkn.0a42d2bc-700a-4cf2-a7ac-ad6b892da7f0'
        content = ir.read_binary(package, 'metadata.xml')
        doc = lxml.etree.parse(io.BytesIO(content))

        harvester = NKNHarvester()
        identifier = harvester.extract_series_identifier(doc)

        self.assertEqual(identifier, '0a42d2bc-700a-4cf2-a7ac-ad6b892da7f0')