118
118
self.assertEquals(False, job.include_binaries)
119
119
self.assertEquals(PackageCopyPolicy.MASS_SYNC, job.copy_policy)
121
def test_createMultiple_creates_one_job_per_copy(self):
122
mother = self.factory.makeDistroSeriesParent()
123
derived_series = mother.derived_series
124
father = self.factory.makeDistroSeriesParent(
125
derived_series=derived_series)
126
mother_package = self.factory.makeSourcePackageName()
127
father_package = self.factory.makeSourcePackageName()
128
job_source = getUtility(IPlainPackageCopyJobSource)
133
mother.parent_series.main_archive,
134
derived_series.main_archive,
135
PackagePublishingPocket.RELEASE,
140
father.parent_series.main_archive,
141
derived_series.main_archive,
142
PackagePublishingPocket.UPDATES,
146
job_source.createMultiple(mother.derived_series, copy_tasks))
147
jobs = list(job_source.getActiveJobs(derived_series.main_archive))
148
self.assertContentEqual(job_ids, [job.id for job in jobs])
149
self.assertEqual(len(copy_tasks), len(set([job.job for job in jobs])))
150
# Get jobs into the same order as copy_tasks, for ease of
152
if jobs[0].package_name != mother_package.name:
153
jobs = reversed(jobs)
163
self.assertEqual(copy_tasks, requested_copies)
121
165
def test_getActiveJobs(self):
122
166
# getActiveJobs() can retrieve all active jobs for an archive.
123
167
distroseries = self.factory.makeDistroSeries()
450
494
name = self.factory.makeSourcePackageName()
451
495
component = self.factory.makeComponent()
452
section=self.factory.makeSection()
496
section = self.factory.makeSection()
453
497
pcj = self.factory.makePlainPackageCopyJob()
454
498
self.layer.txn.commit()
455
499
self.layer.switchDbUser('sync_packages')
475
519
name = self.factory.makeSourcePackageName()
476
520
component = self.factory.makeComponent()
477
section=self.factory.makeSection()
521
section = self.factory.makeSection()
478
522
pcj = self.factory.makePlainPackageCopyJob(
479
523
package_name=name.name, package_version="1.0")
480
524
self.layer.txn.commit()