def test_records_extraction_from_file(app): """Test extracting records from OAI XML.""" with app.app_context(): path_tmp = os.path.join( os.path.dirname(__file__), "data/sample_arxiv_response_with_namespace.xml") assert len(record_extraction_from_file(path_tmp)) == 1
def test_records_extraction_from_file(self): """Test extracting records from OAI XML.""" from invenio_oaiharvester.utils import record_extraction_from_file path_tmp = os.path.join( os.path.dirname(__file__), "data/sample_arxiv_response_with_namespace.xml" ) self.assertEqual(len(record_extraction_from_file(path_tmp)), 1)
def test_records_extraction_from_file(app): """Test extracting records from OAI XML.""" with app.app_context(): path_tmp = os.path.join( os.path.dirname(__file__), "data/sample_arxiv_response_with_namespace.xml" ) assert len(record_extraction_from_file(path_tmp)) == 1
def test_records_extraction_from_file(self): """Test extracting records from OAI XML.""" from invenio_oaiharvester.utils import record_extraction_from_file xml_sample = """ <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> <responseDate>2014-11-05T09:32:51Z</responseDate> <request verb="GetRecord" identifier="oai:arXiv.org:0804.2273" metadataPrefix="arXiv">http://export.arxiv.org/oai2</request> <GetRecord> <record> <header> <identifier>oai:arXiv.org:0804.2273</identifier> <datestamp>2008-04-16</datestamp> <setSpec>cs</setSpec> </header> <metadata> <arXiv xmlns="http://arxiv.org/OAI/arXiv/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://arxiv.org/OAI/arXiv/ http://arxiv.org/OAI/arXiv.xsd"> <id>0804.2273</id><created>2008-04-14</created><authors><author><keyname>Lagoze</keyname><forenames>Carl</forenames></author><author><keyname>Van de Sompel</keyname><forenames>Herbert</forenames></author><author><keyname>Nelson</keyname><forenames>Michael L.</forenames></author><author><keyname>Warner</keyname><forenames>Simeon</forenames></author><author><keyname>Sanderson</keyname><forenames>Robert</forenames></author><author><keyname>Johnston</keyname><forenames>Pete</forenames></author></authors><title>Object Re-Use & Exchange: A Resource-Centric Approach</title><categories>cs.DL cs.NI</categories><acm-class>C.2.3</acm-class><license>http://creativecommons.org/licenses/by/3.0/</license><abstract> The OAI Object Reuse and Exchange (OAI-ORE) framework recasts the repository-centric notion of digital object to a bounded aggregation of Web resources. In this manner, digital library content is more integrated with the Web architecture, and thereby more accessible to Web applications and clients. This generalized notion of an aggregation that is independent of repository containment conforms more closely with notions in eScience and eScholarship, where content is distributed across multiple services and databases. We provide a motivation for the OAI-ORE project, review previous interoperability efforts, describe draft ORE specifications and report on promising results from early experimentation that illustrate improved interoperability and reuse of digital objects. </abstract></arXiv> </metadata> </record> </GetRecord> </OAI-PMH> """ fd_tmp, path_tmp = tempfile.mkstemp() os.write(fd_tmp, xml_sample) os.close(fd_tmp) self.assertEqual(len(record_extraction_from_file(path_tmp)), 1)
def test_records_extraction_from_file(self): """Test extracting records from OAI XML.""" from invenio_oaiharvester.utils import record_extraction_from_file xml_sample = """ <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> <responseDate>2014-11-05T09:32:51Z</responseDate> <request verb="GetRecord" identifier="oai:arXiv.org:0804.2273" metadataPrefix="arXiv">http://export.arxiv.org/oai2</request> <GetRecord> <record> <header> <identifier>oai:arXiv.org:0804.2273</identifier> <datestamp>2008-04-16</datestamp> <setSpec>cs</setSpec> </header> <metadata> <arXiv xmlns="http://arxiv.org/OAI/arXiv/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://arxiv.org/OAI/arXiv/ http://arxiv.org/OAI/arXiv.xsd"> <id>0804.2273</id><created>2008-04-14</created><authors><author><keyname>Lagoze</keyname><forenames>Carl</forenames></author><author><keyname>Van de Sompel</keyname><forenames>Herbert</forenames></author><author><keyname>Nelson</keyname><forenames>Michael L.</forenames></author><author><keyname>Warner</keyname><forenames>Simeon</forenames></author><author><keyname>Sanderson</keyname><forenames>Robert</forenames></author><author><keyname>Johnston</keyname><forenames>Pete</forenames></author></authors><title>Object Re-Use & Exchange: A Resource-Centric Approach</title><categories>cs.DL cs.NI</categories><acm-class>C.2.3</acm-class><license>http://creativecommons.org/licenses/by/3.0/</license><abstract> The OAI Object Reuse and Exchange (OAI-ORE) framework recasts the repository-centric notion of digital object to a bounded aggregation of Web resources. In this manner, digital library content is more integrated with the Web architecture, and thereby more accessible to Web applications and clients. This generalized notion of an aggregation that is independent of repository containment conforms more closely with notions in eScience and eScholarship, where content is distributed across multiple services and databases. We provide a motivation for the OAI-ORE project, review previous interoperability efforts, describe draft ORE specifications and report on promising results from early experimentation that illustrate improved interoperability and reuse of digital objects. </abstract></arXiv> </metadata> </record> </GetRecord> </OAI-PMH> """ fd_tmp, path_tmp = tempfile.mkstemp() os.write(fd_tmp, xml_sample) os.close(fd_tmp) self.assertEqual(len(record_extraction_from_file(path_tmp)), 1)