~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Julian Edwards
  • Date: 2011-07-28 20:46:18 UTC
  • mfrom: (13553 devel)
  • mto: This revision was merged to the branch mainline in revision 13555.
  • Revision ID: julian.edwards@canonical.com-20110728204618-tivj2wx2oa9s32bx
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1624
1624
            set(archive.getComponentsForUploader(person)))
1625
1625
 
1626
1626
 
1627
 
class TestvalidatePPA(TestCaseWithFactory):
 
1627
class TestValidatePPA(TestCaseWithFactory):
1628
1628
 
1629
1629
    layer = DatabaseFunctionalLayer
1630
1630
 
1639
1639
            'A PPA cannot have the same name as its distribution.',
1640
1640
            Archive.validatePPA(ppa_owner, 'ubuntu'))
1641
1641
 
 
1642
    def test_private_ppa_non_commercial_admin(self):
 
1643
        ppa_owner = self.factory.makePerson()
 
1644
        self.assertEqual(
 
1645
            '%s is not allowed to make private PPAs' % (ppa_owner.name,),
 
1646
            Archive.validatePPA(ppa_owner, self.factory.getUniqueString(),
 
1647
                                private=True))
 
1648
 
 
1649
    def test_private_ppa_commercial_admin(self):
 
1650
        ppa_owner = self.factory.makePerson()
 
1651
        with celebrity_logged_in('admin'):
 
1652
            comm = getUtility(ILaunchpadCelebrities).commercial_admin
 
1653
            comm.addMember(ppa_owner, comm.teamowner)
 
1654
        self.assertIs(
 
1655
            None,
 
1656
            Archive.validatePPA(ppa_owner, self.factory.getUniqueString(),
 
1657
                                private=True))
 
1658
 
 
1659
    def test_private_ppa_admin(self):
 
1660
        ppa_owner = self.factory.makeAdministrator()
 
1661
        self.assertIs(
 
1662
            None,
 
1663
            Archive.validatePPA(ppa_owner, self.factory.getUniqueString(),
 
1664
                                private=True))
 
1665
 
1642
1666
    def test_two_ppas(self):
1643
1667
        ppa = self.factory.makeArchive(name='ppa')
1644
1668
        self.assertEqual("You already have a PPA named 'ppa'.",