def test_is_idempotent(self): # It's safe to perform the same copy more than once; the uploads # get copied only once. current_series = self.factory.makeDistroSeries() self.makeUpload(current_series) new_series = self.factory.makeDistroSeries( distribution=current_series.distribution, previous_series=current_series) copier = CustomUploadsCopier(new_series) copier.copy(current_series) uploads_after_first_copy = list_custom_uploads(new_series) copier.copy(current_series) uploads_after_redundant_copy = list_custom_uploads(new_series) self.assertEqual(uploads_after_first_copy, uploads_after_redundant_copy)
def test_is_idempotent(self): # It's safe to perform the same copy more than once; the uploads # get copied only once. current_series = self.factory.makeDistroSeries() self.makeUpload(current_series) new_series = self.factory.makeDistroSeries( distribution=current_series.distribution, previous_series=current_series) copier = CustomUploadsCopier(new_series) copier.copy(current_series) uploads_after_first_copy = list_custom_uploads(new_series) copier.copy(current_series) uploads_after_redundant_copy = list_custom_uploads(new_series) self.assertEqual( uploads_after_first_copy, uploads_after_redundant_copy)
def prepareFreshSeries(self, distribution): """If there are any new distroseries, prepare them for publishing. :return: True if a series did indeed still need some preparation, of False for the normal case. """ have_fresh_series = False for series in distribution.series: suites_needing_indexes = self.listSuitesNeedingIndexes(series) if len(suites_needing_indexes) != 0: # This is a fresh series. have_fresh_series = True if series.previous_series is not None: copier = CustomUploadsCopier( series, PackagePublishingPocket.RELEASE) copier.copy(series.previous_series, PackagePublishingPocket.RELEASE) self.createIndexes(distribution, suites_needing_indexes) return have_fresh_series
def prepareFreshSeries(self, distribution): """If there are any new distroseries, prepare them for publishing. :return: True if a series did indeed still need some preparation, of False for the normal case. """ have_fresh_series = False for series in distribution.series: suites_needing_indexes = self.listSuitesNeedingIndexes(series) if len(suites_needing_indexes) != 0: # This is a fresh series. have_fresh_series = True if series.previous_series is not None: copier = CustomUploadsCopier( series, PackagePublishingPocket.RELEASE) copier.copy( series.previous_series, PackagePublishingPocket.RELEASE) self.createIndexes(distribution, suites_needing_indexes) return have_fresh_series