Beispiel #1
0
    def test_create_multiple_jobs_no_jobs(self):
        # If no job needs to be created, create_multiple_jobs
        # returns an empty list.
        dsp = self.factory.makeDistroSeriesParent()
        job_ids = create_multiple_jobs(dsp.derived_series, dsp.parent_series)

        self.assertEqual([], job_ids)
Beispiel #2
0
    def test_create_multiple_jobs_creates_waiting_jobs(self):
        dsp = self.factory.makeDistroSeriesParent()
        self.createSPPHs(dsp.derived_series, 1)
        job_ids = create_multiple_jobs(dsp.derived_series, dsp.parent_series)
        dsdjob = bulk.load(DistributionJob, job_ids)[0]

        self.assertEqual(JobStatus.WAITING, dsdjob.job.status)
    def test_create_multiple_jobs_no_jobs(self):
        # If no job needs to be created, create_multiple_jobs
        # returns an empty list.
        dsp = self.factory.makeDistroSeriesParent()
        job_ids = create_multiple_jobs(
            dsp.derived_series, dsp.parent_series)

        self.assertEqual([], job_ids)
    def test_create_multiple_jobs_creates_waiting_jobs(self):
        dsp = self.factory.makeDistroSeriesParent()
        self.createSPPHs(dsp.derived_series, 1)
        job_ids = create_multiple_jobs(
            dsp.derived_series, dsp.parent_series)
        dsdjob = bulk.load(DistributionJob, job_ids)[0]

        self.assertEqual(JobStatus.WAITING, dsdjob.job.status)
    def test_create_multiple_jobs_structure(self):
        dsp = self.factory.makeDistroSeriesParent()
        spph = self.createSPPHs(dsp.derived_series, 1)[0]
        job_ids = create_multiple_jobs(
            dsp.derived_series, dsp.parent_series)
        job = bulk.load(DistributionJob, job_ids)[0]

        sourcepackagenameid = spph.sourcepackagerelease.sourcepackagename.id
        expected_metadata = {
            u'sourcepackagename': sourcepackagenameid,
            u'parent_series': dsp.parent_series.id}
        self.assertThat(job, MatchesStructure.byEquality(
            distribution=dsp.derived_series.distribution,
            distroseries=dsp.derived_series,
            job_type=DistributionJobType.DISTROSERIESDIFFERENCE,
            metadata=expected_metadata))
Beispiel #6
0
    def test_create_multiple_jobs_structure(self):
        dsp = self.factory.makeDistroSeriesParent()
        spph = self.createSPPHs(dsp.derived_series, 1)[0]
        job_ids = create_multiple_jobs(dsp.derived_series, dsp.parent_series)
        job = bulk.load(DistributionJob, job_ids)[0]

        sourcepackagenameid = spph.sourcepackagerelease.sourcepackagename.id
        expected_metadata = {
            u'sourcepackagename': sourcepackagenameid,
            u'parent_series': dsp.parent_series.id
        }
        self.assertThat(
            job,
            MatchesStructure.byEquality(
                distribution=dsp.derived_series.distribution,
                distroseries=dsp.derived_series,
                job_type=DistributionJobType.DISTROSERIESDIFFERENCE,
                metadata=expected_metadata))
Beispiel #7
0
    def test_create_multiple_jobs_ignore_other_series(self):
        dsp = self.factory.makeDistroSeriesParent()
        spphs = self.createSPPHs(dsp.derived_series)

        # Create other SPPHs ...
        dsp2 = self.factory.makeDistroSeriesParent()
        self.createSPPHs(dsp2.derived_series)

        # ... and some more.
        dsp3 = self.factory.makeDistroSeriesParent(
            parent_series=dsp.parent_series)
        self.createSPPHs(dsp3.derived_series)

        job_ids = create_multiple_jobs(dsp.derived_series, dsp.parent_series)
        jobs = bulk.load(DistributionJob, job_ids)

        self.assertContentEqual(
            [spph.sourcepackagerelease.sourcepackagename.id for spph in spphs],
            [job.metadata[u'sourcepackagename'] for job in jobs])
    def test_create_multiple_jobs_ignore_other_series(self):
        dsp = self.factory.makeDistroSeriesParent()
        spphs = self.createSPPHs(dsp.derived_series)

        # Create other SPPHs ...
        dsp2 = self.factory.makeDistroSeriesParent()
        self.createSPPHs(dsp2.derived_series)

        # ... and some more.
        dsp3 = self.factory.makeDistroSeriesParent(
            parent_series=dsp.parent_series)
        self.createSPPHs(dsp3.derived_series)

        job_ids = create_multiple_jobs(
            dsp.derived_series, dsp.parent_series)
        jobs = bulk.load(DistributionJob, job_ids)

        self.assertContentEqual(
            [spph.sourcepackagerelease.sourcepackagename.id
                for spph in spphs],
            [job.metadata[u'sourcepackagename'] for job in jobs])