def makeCodeImportJob(self, running):
     person = getUtility(ILaunchpadCelebrities).vcs_imports.teamowner
     if running:
         return removeSecurityProxy(
             run_with_login(person, make_running_import)).import_job
     else:
         return run_with_login(person, self.factory.makeCodeImportJob)
 def test_default_merge_target(self):
     # The default merge target is the development focus branch.
     self.assertIs(None, self.target.default_merge_target)
     # Now create and link a branch.
     branch = self.factory.makeProductBranch(product=self.original)
     run_with_login(self.original.owner, setattr, self.original.development_focus, "branch", branch)
     self.assertEqual(branch, self.target.default_merge_target)
Beispiel #3
0
 def test_default_merge_target(self):
     # The default merge target is the development focus branch.
     self.assertIs(None, self.target.default_merge_target)
     # Now create and link a branch.
     branch = self.factory.makeProductBranch(product=self.original)
     run_with_login(self.original.owner, setattr,
                    self.original.development_focus, 'branch', branch)
     self.assertEqual(branch, self.target.default_merge_target)
 def test_setBranch(self):
     # setBranch sets the official branch for the appropriate pocket of the
     # source package.
     branch = self.factory.makeAnyBranch()
     suite_sourcepackage = self.factory.makeSuiteSourcePackage()
     registrant = suite_sourcepackage.distribution.owner
     run_with_login(registrant,
                    ICanHasLinkedBranch(suite_sourcepackage).setBranch,
                    branch, registrant)
     self.assertEqual(
         branch,
         suite_sourcepackage.sourcepackage.getBranch(
             suite_sourcepackage.pocket))
 def test_setBranch(self):
     # setBranch sets the official branch for the appropriate pocket of the
     # source package.
     branch = self.factory.makeAnyBranch()
     suite_sourcepackage = self.factory.makeSuiteSourcePackage()
     registrant = suite_sourcepackage.distribution.owner
     run_with_login(
         registrant,
         ICanHasLinkedBranch(suite_sourcepackage).setBranch,
         branch, registrant)
     self.assertEqual(
         branch,
         suite_sourcepackage.sourcepackage.getBranch(
             suite_sourcepackage.pocket))
 def test_resolve_distro_package_branch(self):
     # getByLPPath returns the branch associated with the distribution
     # source package referred to by the path.
     sourcepackage = self.factory.makeSourcePackage()
     branch = self.factory.makePackageBranch(sourcepackage=sourcepackage)
     distro_package = sourcepackage.distribution_sourcepackage
     registrant = sourcepackage.distribution.owner
     run_with_login(registrant,
                    ICanHasLinkedBranch(distro_package).setBranch, branch,
                    registrant)
     self.assertEqual(
         (branch, ''),
         self.branch_lookup.getByLPPath(
             '%s/%s' % (distro_package.distribution.name,
                        distro_package.sourcepackagename.name)))
Beispiel #7
0
 def makePackageProposal(self):
     branch = self.factory.makePackageBranch()
     # Make sure the (distroseries, pocket) combination used allows us to
     # upload to it.
     pocket = PackagePublishingPocket.RELEASE
     sourcepackage = branch.sourcepackage
     suite_sourcepackage = sourcepackage.getSuiteSourcePackage(pocket)
     registrant = self.factory.makePerson()
     run_with_login(suite_sourcepackage.distribution.owner,
                    ICanHasLinkedBranch(suite_sourcepackage).setBranch,
                    branch, registrant)
     source_branch = self.factory.makePackageBranch(
         sourcepackage=branch.sourcepackage)
     proposal = source_branch.addLandingTarget(source_branch.registrant,
                                               branch)
     return proposal
 def test_resolve_distro_package_branch(self):
     # getByLPPath returns the branch associated with the distribution
     # source package referred to by the path.
     sourcepackage = self.factory.makeSourcePackage()
     branch = self.factory.makePackageBranch(sourcepackage=sourcepackage)
     distro_package = sourcepackage.distribution_sourcepackage
     registrant = sourcepackage.distribution.owner
     run_with_login(
         registrant,
         ICanHasLinkedBranch(distro_package).setBranch, branch, registrant)
     self.assertEqual(
         (branch, ''),
         self.branch_lookup.getByLPPath(
             '%s/%s' % (
                 distro_package.distribution.name,
                 distro_package.sourcepackagename.name)))
    def test_setBranch(self):
        # Setting the linked branch for a distribution source package links
        # the branch to the release pocket of the development focus series for
        # that package.
        branch = self.factory.makeAnyBranch()
        sourcepackage = self.factory.makeSourcePackage()
        distribution_sourcepackage = sourcepackage.distribution_sourcepackage

        registrant = sourcepackage.distribution.owner
        run_with_login(
            registrant,
            ICanHasLinkedBranch(distribution_sourcepackage).setBranch, branch,
            registrant)

        dev_sourcepackage = sourcepackage.development_version
        pocket = PackagePublishingPocket.RELEASE
        self.assertEqual(branch, dev_sourcepackage.getBranch(pocket))
Beispiel #10
0
def make_official_package_branch(factory, owner=None):
    """Make a branch linked to the pocket of a source package."""
    branch = factory.makePackageBranch(owner=owner)
    # Make sure the (distroseries, pocket) combination used allows us to
    # upload to it.
    stable_states = (SeriesStatus.SUPPORTED, SeriesStatus.CURRENT)
    if branch.distroseries.status in stable_states:
        pocket = PackagePublishingPocket.BACKPORTS
    else:
        pocket = PackagePublishingPocket.RELEASE
    sourcepackage = branch.sourcepackage
    suite_sourcepackage = sourcepackage.getSuiteSourcePackage(pocket)
    registrant = factory.makePerson()
    run_with_login(
        suite_sourcepackage.distribution.owner, ICanHasLinkedBranch(suite_sourcepackage).setBranch, branch, registrant
    )
    return branch
 def makePackageProposal(self):
     branch = self.factory.makePackageBranch()
     # Make sure the (distroseries, pocket) combination used allows us to
     # upload to it.
     pocket = PackagePublishingPocket.RELEASE
     sourcepackage = branch.sourcepackage
     suite_sourcepackage = sourcepackage.getSuiteSourcePackage(pocket)
     registrant = self.factory.makePerson()
     run_with_login(
         suite_sourcepackage.distribution.owner,
         ICanHasLinkedBranch(suite_sourcepackage).setBranch,
         branch, registrant)
     source_branch = self.factory.makePackageBranch(
         sourcepackage=branch.sourcepackage)
     proposal = source_branch.addLandingTarget(
         source_branch.registrant, branch)
     return proposal
    def test_setBranch(self):
        # Setting the linked branch for a distribution source package links
        # the branch to the release pocket of the development focus series for
        # that package.
        branch = self.factory.makeAnyBranch()
        sourcepackage = self.factory.makeSourcePackage()
        distribution_sourcepackage = sourcepackage.distribution_sourcepackage

        registrant = sourcepackage.distribution.owner
        run_with_login(
            registrant,
            ICanHasLinkedBranch(distribution_sourcepackage).setBranch,
            branch, registrant)

        dev_sourcepackage = sourcepackage.development_version
        pocket = PackagePublishingPocket.RELEASE
        self.assertEqual(branch, dev_sourcepackage.getBranch(pocket))
Beispiel #13
0
def make_official_package_branch(factory, owner=None):
    """Make a branch linked to the pocket of a source package."""
    branch = factory.makePackageBranch(owner=owner)
    # Make sure the (distroseries, pocket) combination used allows us to
    # upload to it.
    stable_states = (
        SeriesStatus.SUPPORTED, SeriesStatus.CURRENT)
    if branch.distroseries.status in stable_states:
        pocket = PackagePublishingPocket.BACKPORTS
    else:
        pocket = PackagePublishingPocket.RELEASE
    sourcepackage = branch.sourcepackage
    suite_sourcepackage = sourcepackage.getSuiteSourcePackage(pocket)
    registrant = factory.makePerson()
    run_with_login(
        suite_sourcepackage.distribution.owner,
        ICanHasLinkedBranch(suite_sourcepackage).setBranch,
        branch, registrant)
    return branch
    def test_renders_with_source_package_branch(self):
        mint = self.factory.makeDistribution(name='mint')
        dev = self.factory.makeDistroSeries(
            distribution=mint, version='1.0', name='dev')
        eric = self.factory.makePerson(name='eric')
        branch = self.factory.makePackageBranch(
            distroseries=dev, sourcepackagename='choc', name='tip',
            owner=eric)
        dsp = self.factory.makeDistributionSourcePackage('choc', mint)
        development_package = dsp.development_version
        suite_sourcepackage = development_package.getSuiteSourcePackage(
            PackagePublishingPocket.RELEASE)
        suite_sp_link = ICanHasLinkedBranch(suite_sourcepackage)

        registrant = suite_sourcepackage.distribution.owner
        run_with_login(
            registrant,
            suite_sp_link.setBranch, branch, registrant)
        branch.updateScannedDetails(None, 0)
        logout()
        lp = launchpadlib_for("test")
        list(lp.branches)
Beispiel #15
0
    def assertPermission(self, can_access, person, secure_object, permission):
        """Assert that 'person' can or cannot access 'secure_object'.

        :param can_access: Whether or not the person can access the object.
        :param person: The `IPerson` who is trying to access the object.
        :param secure_object: The secured object.
        :param permission: The Launchpad permission that 'person' is trying to
            access 'secure_object' with.
        """
        self.assertEqual(
            can_access,
            run_with_login(
                person, check_permission, permission, secure_object))
Beispiel #16
0
    def test_renders_with_source_package_branch(self):
        mint = self.factory.makeDistribution(name='mint')
        dev = self.factory.makeDistroSeries(distribution=mint,
                                            version='1.0',
                                            name='dev')
        eric = self.factory.makePerson(name='eric')
        branch = self.factory.makePackageBranch(distroseries=dev,
                                                sourcepackagename='choc',
                                                name='tip',
                                                owner=eric)
        dsp = self.factory.makeDistributionSourcePackage('choc', mint)
        development_package = dsp.development_version
        suite_sourcepackage = development_package.getSuiteSourcePackage(
            PackagePublishingPocket.RELEASE)
        suite_sp_link = ICanHasLinkedBranch(suite_sourcepackage)

        registrant = suite_sourcepackage.distribution.owner
        run_with_login(registrant, suite_sp_link.setBranch, branch, registrant)
        branch.updateScannedDetails(None, 0)
        logout()
        lp = launchpadlib_for("test")
        list(lp.branches)
    def assertPermission(self, can_access, person, secure_object, permission):
        """Assert that 'person' can or cannot access 'secure_object'.

        :param can_access: Whether or not the person can access the object.
        :param person: The `IPerson` who is trying to access the object.
        :param secure_object: The secured object.
        :param permission: The Launchpad permission that 'person' is trying to
            access 'secure_object' with.
        """
        self.assertEqual(
            can_access,
            run_with_login(
                person, check_permission, permission, secure_object))
 def makeCodeImportJob(self, running):
     person = getUtility(ILaunchpadCelebrities).vcs_imports.teamowner
     if running:
         return removeSecurityProxy(run_with_login(person, make_running_import)).import_job
     else:
         return run_with_login(person, self.factory.makeCodeImportJob)