def test_fetch(self): ''' Parse example dataset ''' registry = importformats.create_metadata_registry() client = oaipmh.client.Client(_get_fixture(FIXTURE_DATASET), registry) record = client.getRecord(identifier=self.TEST_ID, metadataPrefix='oai_dc') assert record
def test_fetch_fail(self): ''' Try to parse ListIdentifiers result as a dataset (basically testing PyOAI) ''' def getrecord(): client.getRecord(identifier=self.TEST_ID, metadataPrefix='oai_dc') registry = importformats.create_metadata_registry() client = oaipmh.client.Client(_get_fixture(FIXTURE_LISTIDENTIFIERS), registry) self.assertRaises(Exception, getrecord)
def test_list(self): ''' Parse ListIdentifiers result ''' registry = importformats.create_metadata_registry() client = oaipmh.client.Client(_get_fixture(FIXTURE_LISTIDENTIFIERS), registry) identifiers = (header.identifier() for header in client.listIdentifiers(metadataPrefix='oai_dc')) assert 'oai:arXiv.org:hep-th/9801001' in identifiers assert 'oai:arXiv.org:hep-th/9801002' in identifiers assert 'oai:arXiv.org:hep-th/9801005' in identifiers assert 'oai:arXiv.org:hep-th/9801010' in identifiers
def test_list(self): ''' Parse ListIdentifiers result ''' registry = importformats.create_metadata_registry() client = oaipmh.client.Client(_get_fixture(FIXTURE_LISTIDENTIFIERS), registry) identifiers = (header.identifier() for header in client.listIdentifiers( metadataPrefix='oai_dc')) assert 'oai:arXiv.org:hep-th/9801001' in identifiers assert 'oai:arXiv.org:hep-th/9801002' in identifiers assert 'oai:arXiv.org:hep-th/9801005' in identifiers assert 'oai:arXiv.org:hep-th/9801010' in identifiers
def test_create_metadata_registry(self): reg = create_metadata_registry() assert reg assert reg.hasReader('oai_dc')