def test_data_update(self): # create migrations for index in range(40): superdesk.commands.data_updates.DEFAULT_DATA_UPDATE_FW_IMPLEMENTATION = ''' assert(mongodb_collection) count = mongodb_collection.find({}).count() assert count is %d, count assert(mongodb_database) ''' % (index) superdesk.commands.data_updates.DEFAULT_DATA_UPDATE_BW_IMPLEMENTATION = ''' assert(mongodb_collection) count = mongodb_collection.find({}).count() assert count is %d, count assert(mongodb_database) ''' % (index + 1) GenerateUpdate().run(resource_name='data_updates') assert(self.number_of_data_updates_applied() is 0) thirdieth_update = get_data_updates_files(True)[29] Upgrade().run(data_update_id=thirdieth_update) assert(self.number_of_data_updates_applied() is 30) Upgrade().run() assert(self.number_of_data_updates_applied() is 40) Downgrade().run() assert(self.number_of_data_updates_applied() is 39) Downgrade().run(data_update_id=thirdieth_update) assert(self.number_of_data_updates_applied() is 29) Upgrade().run()
def test_data_update(self): # create migrations for index in range(40): superdesk.commands.data_updates.DEFAULT_DATA_UPDATE_FW_IMPLEMENTATION = """ assert mongodb_collection count = mongodb_collection.find({}).count() assert count == %d, count assert mongodb_database """ % (index) superdesk.commands.data_updates.DEFAULT_DATA_UPDATE_BW_IMPLEMENTATION = """ assert mongodb_collection count = mongodb_collection.find({}).count() assert count == %d, count assert mongodb_database """ % (index + 1) GenerateUpdate().run(resource_name="data_updates") assert self.number_of_data_updates_applied() == 0 thirdieth_update = get_data_updates_files(True)[29] Upgrade().run(data_update_id=thirdieth_update) assert self.number_of_data_updates_applied() == 30 Upgrade().run() assert self.number_of_data_updates_applied() == 40 Downgrade().run() assert self.number_of_data_updates_applied() == 39 Downgrade().run(data_update_id=thirdieth_update) assert self.number_of_data_updates_applied() == 29 Upgrade().run()
def test_data_update_generation(self): assert len(get_data_updates_files()) is 0, get_data_updates_files() GenerateUpdate().run(resource_name='RESOURCE_NAME') assert len(get_data_updates_files()) is 1, get_data_updates_files() GenerateUpdate().run(resource_name='RESOURNCE_NAME') assert len(get_data_updates_files()) is 2, get_data_updates_files()
def test_data_update_generation(self): assert len(get_data_updates_files()) == 0, get_data_updates_files() GenerateUpdate().run(resource_name="RESOURCE_NAME") assert len(get_data_updates_files()) == 1, get_data_updates_files() GenerateUpdate().run(resource_name="RESOURNCE_NAME") assert len(get_data_updates_files()) == 2, get_data_updates_files()