def test_get_mets(self, mets_xsd, metadata_xml_dc, dissemin_xml_1_0): """ A test for creating mets from metadata """ mets_xml = SWORDMETSProtocol._get_mets(metadata_xml_dc, dissemin_xml_1_0) # Because of the xml declaration we have to convert to a bytes object mets_xsd.assertValid( etree.fromstring(bytes(mets_xml, encoding='utf-8')))
def test_get_mets_container(self, blank_pdf_path, metadata_xml_mets): """ A test for creating a mets container """ s = SWORDMETSProtocol._get_mets_container(blank_pdf_path, metadata_xml_mets) with ZipFile(s, 'r') as zip_file: files = zip_file.namelist() for filename in ['mets.xml', 'document.pdf']: assert filename in files assert not zip_file.testzip()
def test_get_xml_metadata(): """ Function must not be implemented in SWORDMETSProtocol """ with pytest.raises(NotImplementedError): SWORDMETSProtocol._get_xml_metadata(None)