Ejemplo n.º 1
0
 def test_getCandidateUploads_filters_by_distroseries(self):
     # getCandidateUploads ignores uploads for other distroseries.
     source_series = self.factory.makeDistroSeries()
     matching_upload = self.makeUpload(source_series)
     nonmatching_upload = self.makeUpload()
     copier = CustomUploadsCopier(FakeDistroSeries())
     candidate_uploads = copier.getCandidateUploads(source_series)
     self.assertContentEqual([matching_upload], candidate_uploads)
     self.assertNotIn(nonmatching_upload, candidate_uploads)
 def test_getCandidateUploads_filters_by_distroseries(self):
     # getCandidateUploads ignores uploads for other distroseries.
     source_series = self.factory.makeDistroSeries()
     matching_upload = self.makeUpload(source_series)
     nonmatching_upload = self.makeUpload()
     copier = CustomUploadsCopier(FakeDistroSeries())
     candidate_uploads = copier.getCandidateUploads(source_series)
     self.assertContentEqual([matching_upload], candidate_uploads)
     self.assertNotIn(nonmatching_upload, candidate_uploads)
Ejemplo n.º 3
0
 def test_getCandidateUploads_filters_by_pocket(self):
     # getCandidateUploads ignores uploads for other pockets.
     source_series = self.factory.makeDistroSeries()
     matching_upload = self.makeUpload(
         source_series, pocket=PackagePublishingPocket.PROPOSED)
     nonmatching_upload = self.makeUpload(
         source_series, pocket=PackagePublishingPocket.BACKPORTS)
     copier = CustomUploadsCopier(FakeDistroSeries())
     candidate_uploads = copier.getCandidateUploads(
         source_series, PackagePublishingPocket.PROPOSED)
     self.assertContentEqual([matching_upload], candidate_uploads)
     self.assertNotIn(nonmatching_upload, candidate_uploads)
Ejemplo n.º 4
0
    def test_getCandidateUploads_filters_upload_types(self):
        # getCandidateUploads returns only uploads of the types listed
        # in copyable_types; other types of upload are ignored.
        source_series = self.factory.makeDistroSeries()
        for custom_format in PackageUploadCustomFormat.items:
            self.makeUpload(source_series, custom_type=custom_format)

        copier = CustomUploadsCopier(FakeDistroSeries())
        candidate_uploads = copier.getCandidateUploads(source_series)
        copied_types = [upload.customformat for upload in candidate_uploads]
        self.assertContentEqual(CustomUploadsCopier.copyable_types,
                                copied_types)
 def test_getCandidateUploads_filters_by_pocket(self):
     # getCandidateUploads ignores uploads for other pockets.
     source_series = self.factory.makeDistroSeries()
     matching_upload = self.makeUpload(
         source_series, pocket=PackagePublishingPocket.PROPOSED)
     nonmatching_upload = self.makeUpload(
         source_series, pocket=PackagePublishingPocket.BACKPORTS)
     copier = CustomUploadsCopier(FakeDistroSeries())
     candidate_uploads = copier.getCandidateUploads(
         source_series, PackagePublishingPocket.PROPOSED)
     self.assertContentEqual([matching_upload], candidate_uploads)
     self.assertNotIn(nonmatching_upload, candidate_uploads)
 def test_getCandidateUploads_orders_newest_to_oldest(self):
     # getCandidateUploads returns its PackageUploadCustoms ordered
     # from newest to oldest.
     # XXX JeroenVermeulen 2011-08-17, bug=827967: Should compare by
     # Debian version string, not id.
     source_series = self.factory.makeDistroSeries()
     for counter in xrange(5):
         self.makeUpload(source_series)
     copier = CustomUploadsCopier(FakeDistroSeries())
     candidate_ids = [
         upload.id for upload in copier.getCandidateUploads(source_series)]
     self.assertEqual(sorted(candidate_ids, reverse=True), candidate_ids)
    def test_getCandidateUploads_filters_upload_types(self):
        # getCandidateUploads returns only uploads of the types listed
        # in copyable_types; other types of upload are ignored.
        source_series = self.factory.makeDistroSeries()
        for custom_format in PackageUploadCustomFormat.items:
            self.makeUpload(source_series, custom_type=custom_format)

        copier = CustomUploadsCopier(FakeDistroSeries())
        candidate_uploads = copier.getCandidateUploads(source_series)
        copied_types = [upload.customformat for upload in candidate_uploads]
        self.assertContentEqual(
            CustomUploadsCopier.copyable_types, copied_types)
Ejemplo n.º 8
0
 def test_getCandidateUploads_orders_newest_to_oldest(self):
     # getCandidateUploads returns its PackageUploadCustoms ordered
     # from newest to oldest.
     # XXX JeroenVermeulen 2011-08-17, bug=827967: Should compare by
     # Debian version string, not id.
     source_series = self.factory.makeDistroSeries()
     for counter in range(5):
         self.makeUpload(source_series)
     copier = CustomUploadsCopier(FakeDistroSeries())
     candidate_ids = [
         upload.id for upload in copier.getCandidateUploads(source_series)
     ]
     self.assertEqual(sorted(candidate_ids, reverse=True), candidate_ids)
Ejemplo n.º 9
0
 def test_getCandidateUploads_ignores_other_attachments(self):
     # A PackageUpload can have multiple PackageUploadCustoms
     # attached, potentially of different types.  getCandidateUploads
     # ignores PackageUploadCustoms of types that aren't supposed to
     # be copied, even if they are attached to PackageUploads that
     # also have PackageUploadCustoms that do need to be copied.
     source_series = self.factory.makeDistroSeries()
     package_upload = self.factory.makePackageUpload(
         distroseries=source_series, archive=source_series.main_archive)
     library_file = self.factory.makeLibraryFileAlias()
     matching_upload = package_upload.addCustom(
         library_file, PackageUploadCustomFormat.DEBIAN_INSTALLER)
     nonmatching_upload = package_upload.addCustom(
         library_file, PackageUploadCustomFormat.STATIC_TRANSLATIONS)
     copier = CustomUploadsCopier(FakeDistroSeries())
     candidates = copier.getCandidateUploads(source_series)
     self.assertContentEqual([matching_upload], candidates)
     self.assertNotIn(nonmatching_upload, candidates)
 def test_getCandidateUploads_ignores_other_attachments(self):
     # A PackageUpload can have multiple PackageUploadCustoms
     # attached, potentially of different types.  getCandidateUploads
     # ignores PackageUploadCustoms of types that aren't supposed to
     # be copied, even if they are attached to PackageUploads that
     # also have PackageUploadCustoms that do need to be copied.
     source_series = self.factory.makeDistroSeries()
     package_upload = self.factory.makePackageUpload(
         distroseries=source_series, archive=source_series.main_archive)
     library_file = self.factory.makeLibraryFileAlias()
     matching_upload = package_upload.addCustom(
         library_file, PackageUploadCustomFormat.DEBIAN_INSTALLER)
     nonmatching_upload = package_upload.addCustom(
         library_file, PackageUploadCustomFormat.ROSETTA_TRANSLATIONS)
     copier = CustomUploadsCopier(FakeDistroSeries())
     candidates = copier.getCandidateUploads(source_series)
     self.assertContentEqual([matching_upload], candidates)
     self.assertNotIn(nonmatching_upload, candidates)