~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/tests/test_packagecopyjob.py

[r=julian-edwards][bug=812867] Add SELECT on archivearch for
        sync_packages so that copies into PPAs via Archive.copyPackages
        now work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        except:
117
117
            transaction.abort()
118
118
            job.fail()
 
119
        else:
 
120
            job.complete()
119
121
 
120
122
 
121
123
class PlainPackageCopyJobTests(TestCaseWithFactory, LocalTestHelper):
581
583
        self.assertEqual('restricted', new_publication.component.name)
582
584
        self.assertEqual('games', new_publication.section.name)
583
585
 
 
586
    def test_copying_to_ppa_archive(self):
 
587
        # Packages can be copied into PPA archives.
 
588
        publisher = SoyuzTestPublisher()
 
589
        publisher.prepareBreezyAutotest()
 
590
        distroseries = publisher.breezy_autotest
 
591
 
 
592
        target_archive = self.factory.makeArchive(
 
593
            distroseries.distribution, purpose=ArchivePurpose.PPA)
 
594
        source_archive = self.factory.makeArchive()
 
595
 
 
596
        # Publish a package in the source archive with some overridable
 
597
        # properties set to known values.
 
598
        publisher.getPubSource(
 
599
            distroseries=distroseries, sourcename="libc",
 
600
            component='universe', section='web',
 
601
            version="2.8-1", status=PackagePublishingStatus.PUBLISHED,
 
602
            archive=source_archive)
 
603
 
 
604
        # Now, run the copy job.
 
605
        source = getUtility(IPlainPackageCopyJobSource)
 
606
        requester = self.factory.makePerson()
 
607
        with person_logged_in(target_archive.owner):
 
608
            target_archive.newComponentUploader(requester, "main")
 
609
        job = source.create(
 
610
            package_name="libc",
 
611
            package_version="2.8-1",
 
612
            source_archive=source_archive,
 
613
            target_archive=target_archive,
 
614
            target_distroseries=distroseries,
 
615
            target_pocket=PackagePublishingPocket.RELEASE,
 
616
            include_binaries=False,
 
617
            requester=requester)
 
618
 
 
619
        self.runJob(job)
 
620
        self.assertEqual(JobStatus.COMPLETED, job.status)
 
621
 
 
622
        new_publication = target_archive.getPublishedSources(
 
623
            name='libc', version='2.8-1').one()
 
624
        self.assertEqual('main', new_publication.component.name)
 
625
        self.assertEqual('web', new_publication.section.name)
 
626
 
584
627
    def test_copying_to_main_archive_manual_overrides(self):
585
628
        # Test processing a packagecopyjob that has manual overrides.
586
629
        publisher = SoyuzTestPublisher()