def getXMLTreeServer(self): directory = os.path.dirname(__file__) fake1 = os.path.join(directory, 'fake1') myserver = fakeclient.FakeClient(fake1) metadata_registry = metadata.MetadataRegistry() metadata_registry.registerWriter('oai_dc', server.oai_dc_writer) return server.XMLTreeServer(server.Resumption(myserver), metadata_registry)
def test_tree_resumption(self): metadata_registry = metadata.MetadataRegistry() metadata_registry.registerWriter('oai_dc', server.oai_dc_writer) myserver = server.XMLTreeServer(self._server, metadata_registry) tree = myserver.listIdentifiers(metadataPrefix='oai_dc') self.assert_(oaischema.validate(tree)) # we should find a resumptionToken element with text self.assert_( tree.xpath('//oai:resumptionToken/text()', namespaces={'oai': NS_OAIPMH}))
def setUp(self): self._fakeserver = fakeserver.FakeServer() metadata_registry = metadata.MetadataRegistry() metadata_registry.registerWriter('oai_dc', server.oai_dc_writer) metadata_registry.registerReader('oai_dc', metadata.oai_dc_reader) self._xmlserver = server.XMLTreeServer( self._fakeserver, metadata_registry, nsmap={'cow': 'http://www.cow.com'}) self._server = server.Server(self._fakeserver, metadata_registry, nsmap={'cow': 'http://www.cow.com'})