~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-22 08:55:33 UTC
  • mfrom: (13482.3.2 no-copyPackage-with-ppa)
  • Revision ID: launchpad@pqm.canonical.com-20110722085533-0k8pcgrzr22telnv
[r=julian-edwards][no-qa] Prevent use of
 IArchive.copyPackage/copyPackages when the destination is a PPA because we
 don't yet have a way to give failure feedback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1947
1947
    def test_copyPackage_requires_feature_flag(self):
1948
1948
        # Ensure feature is off.
1949
1949
        self.useFixture(FeatureFixture({u"soyuz.copypackage.enabled": ''}))
1950
 
        archive = self.factory.makeArchive()
 
1950
        archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
1951
1951
        self.assertRaises(
1952
1952
            ForbiddenByFeatureFlag,
1953
1953
            archive.copyPackage,
1956
1956
    def test_copyPackages_requires_feature_flag(self):
1957
1957
        # Ensure feature is off.
1958
1958
        self.useFixture(FeatureFixture({u"soyuz.copypackage.enabled": ''}))
1959
 
        archive = self.factory.makeArchive()
 
1959
        archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
 
1960
        self.assertRaises(
 
1961
            ForbiddenByFeatureFlag,
 
1962
            archive.copyPackages,
 
1963
            None, None, None, None, None)
 
1964
 
 
1965
    def test_copyPackage_to_ppa_requires_feature_flag(self):
 
1966
        # Ensure feature is off.
 
1967
        self.useFixture(FeatureFixture({u"soyuz.copypackage.enabled": 'on'}))
 
1968
        self.useFixture(FeatureFixture({u"soyuz.copypackageppa.enabled": ''}))
 
1969
        archive = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
 
1970
        self.assertRaises(
 
1971
            ForbiddenByFeatureFlag,
 
1972
            archive.copyPackage,
 
1973
            None, None, None, None, None)
 
1974
 
 
1975
    def test_copyPackages_to_ppa_requires_feature_flag(self):
 
1976
        # Ensure feature is off.
 
1977
        self.useFixture(FeatureFixture({u"soyuz.copypackage.enabled": 'on'}))
 
1978
        self.useFixture(FeatureFixture({u"soyuz.copypackageppa.enabled": ''}))
 
1979
        archive = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
1960
1980
        self.assertRaises(
1961
1981
            ForbiddenByFeatureFlag,
1962
1982
            archive.copyPackages,
1969
1989
 
1970
1990
    def setUp(self):
1971
1991
        super(TestSyncSource, self).setUp()
1972
 
        self.useFixture(FeatureFixture({u"soyuz.copypackage.enabled": 'on'}))
 
1992
        self.useFixture(FeatureFixture({
 
1993
            u"soyuz.copypackage.enabled": 'on',
 
1994
            u"soyuz.copypackageppa.enabled": 'on',
 
1995
            }))
1973
1996
 
1974
1997
    def test_security_team_can_copy_to_primary(self):
1975
1998
        # A member of ubuntu-security can use syncSource on any package