def test_zcatalog(self): """ Using the ZCatalog storage Test flow: Add an OAIHarvester with the local URL of the OAIServer -> update it against and check the presence of the OAIRecords. Add one folder -> update the OAIServer -> update OAIAggregator -> update the specific OAIHarvester and recheck it there is a new OAIRecord in the OAIHarvester Same ideea after deleting the folder that was added. """ manage_addOAIAggregator(self.app, 'oai_agg', title=u"OAI Aggregator", storage='ZCatalog') manage_addOAIHarvester(self.app.oai_agg, 'oai_harv', title=u"Local OAI Server", url=self.server_url + 'oai') self.app.oai_agg.update() # Has 2 records in it's contents self.assertEqual(len(self.app.oai_agg.oai_harv.\ objectValues([OAIRecord.meta_type])), 2) #Search catalog catalog = self.app.oai_agg.getCatalog() results = catalog.searchResults(meta_type=OAIRecord.meta_type) self.assertEqual(len(results), 2) #Adding one folder and repeat the procedure manage_addFolder(self.app, 'other_folder', 'Some other folder') self.app.other_folder.description = u'This is some kind of description' self.app.catalog.catalog_object(self.app.other_folder, self.app.other_folder.absolute_url(1)) self.app.oai.harvester.update(True) #Update forced #Update the aggregator once again self.app.oai_agg.update() # Has 2 records in it's contents because the harvester can be updated # only after a day self.assertEqual(len(self.app.oai_agg.oai_harv.\ objectValues([OAIRecord.meta_type])), 2) #We need to do an manual update of the harvester self.app.oai_agg.oai_harv.update() self.assertEqual(len(self.app.oai_agg.oai_harv.\ objectValues([OAIRecord.meta_type])), 3) self.app.catalog.uncatalog_object( self.app.other_folder.absolute_url(1)) self.app.manage_delObjects(['other_folder']) #Updating ZCatalogHarvester self.app.oai.harvester.update(True) #Update forced #updating OAIHarvester self.app.oai_agg.oai_harv.update() self.assertEqual(len(self.app.oai_agg.oai_harv.\ objectValues([OAIRecord.meta_type])), 2)
def test_basic(self): """ """ manage_addOAIHarvester(self.app.oai, id='oai_harvester', title=u'OAI ' 'Harvester', url='http://google.com/') self.assertTrue(hasattr(self.app.oai, 'oai_harvester'))