~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[r=julian-edwards][bug=777911,
 780429][rollback=12988] Revert part of r12988's behaviour.
 Archive.syncSource(s) bypass do_copy's permission check,
 as they are protected by launchpad.Append. CopyChecker.checkCopy no longer
 checks launchpad.Append itself.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1744
1744
        two_hours_earlier = one_hour_earlier - one_hour_step
1745
1745
        self.assertEqual(3, cprov_archive.getPublishedSources(
1746
1746
            created_since_date=two_hours_earlier).count())
 
1747
 
 
1748
 
 
1749
class TestSyncSource(TestCaseWithFactory):
 
1750
 
 
1751
    layer = DatabaseFunctionalLayer
 
1752
 
 
1753
    def test_security_team_can_copy_to_primary(self):
 
1754
        # A member of ubuntu-security can use syncSource on any package
 
1755
        # in the Ubuntu primary archive, regardless of their normal
 
1756
        # upload permissions.
 
1757
        # This is until we can open syncSource up more widely and sort
 
1758
        # out the permissions that everyone needs.
 
1759
        with celebrity_logged_in('admin'):
 
1760
            security_person = self.factory.makePerson()
 
1761
            getUtility(ILaunchpadCelebrities).ubuntu_security.addMember(
 
1762
                security_person, security_person)
 
1763
        ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
 
1764
        source = self.factory.makeSourcePackagePublishingHistory(
 
1765
            archive=self.factory.makeArchive(purpose=ArchivePurpose.PPA),
 
1766
            distroseries=ubuntu.currentseries)
 
1767
        self.assertEqual(
 
1768
            0,
 
1769
            ubuntu.main_archive.getPublishedSources(
 
1770
                name=source.source_package_name).count())
 
1771
        with person_logged_in(security_person):
 
1772
            ubuntu.main_archive.syncSource(
 
1773
                source_name=source.source_package_name,
 
1774
                version=source.source_package_version,
 
1775
                from_archive=source.archive,
 
1776
                to_pocket='Security')
 
1777
        self.assertEqual(
 
1778
            1,
 
1779
            ubuntu.main_archive.getPublishedSources(
 
1780
                name=source.source_package_name).count())