コード例 #1
0
    def test_close_bugs_for_sourcepackagerelease_with_private_bug(self):
        """close_bugs_for_sourcepackagerelease works with private bugs."""
        changes_file_template = "Format: 1.7\nLaunchpad-bugs-fixed: %s\n"
        # changelog_entry is required for an assertion inside the function
        # we're testing.
        spr = self.factory.makeSourcePackageRelease(changelog_entry="blah")
        archive_admin = self.factory.makePerson()
        series = spr.upload_distroseries
        dsp = series.distribution.getSourcePackage(spr.sourcepackagename)
        bug = self.factory.makeBug(
            target=dsp, information_type=InformationType.USERDATA)
        changes = StringIO(changes_file_template % bug.id)

        with person_logged_in(archive_admin):
            # The archive admin user can't normally see this bug.
            self.assertRaises(ForbiddenAttribute, bug, 'status')
            # But the bug closure should work.
            close_bugs_for_sourcepackagerelease(series, spr, changes)

        # Rather than closing the bugs immediately, this creates a
        # ProcessAcceptedBugsJob.
        with celebrity_logged_in("admin"):
            self.assertEqual(BugTaskStatus.NEW, bug.default_bugtask.status)
        job_source = getUtility(IProcessAcceptedBugsJobSource)
        [job] = list(job_source.iterReady())
        self.assertEqual(series, job.distroseries)
        self.assertEqual(spr, job.sourcepackagerelease)
        self.assertEqual([bug.id], job.bug_ids)
コード例 #2
0
    def test_close_bugs_for_sourcepackagerelease_with_private_bug(self):
        """close_bugs_for_sourcepackagerelease works with private bugs."""
        changes_file_template = "Format: 1.7\nLaunchpad-bugs-fixed: %s\n"
        # changelog_entry is required for an assertion inside the function
        # we're testing.
        spr = self.factory.makeSourcePackageRelease(changelog_entry="blah")
        archive_admin = self.factory.makePerson()
        series = spr.upload_distroseries
        dsp = series.distribution.getSourcePackage(spr.sourcepackagename)
        bug = self.factory.makeBug(target=dsp,
                                   information_type=InformationType.USERDATA)
        changes = StringIO(changes_file_template % bug.id)

        with person_logged_in(archive_admin):
            # The archive admin user can't normally see this bug.
            self.assertRaises(ForbiddenAttribute, bug, 'status')
            # But the bug closure should work.
            close_bugs_for_sourcepackagerelease(series, spr, changes)

        # Rather than closing the bugs immediately, this creates a
        # ProcessAcceptedBugsJob.
        with celebrity_logged_in("admin"):
            self.assertEqual(BugTaskStatus.NEW, bug.default_bugtask.status)
        job_source = getUtility(IProcessAcceptedBugsJobSource)
        [job] = list(job_source.iterReady())
        self.assertEqual(series, job.distroseries)
        self.assertEqual(spr, job.sourcepackagerelease)
        self.assertEqual([bug.id], job.bug_ids)
コード例 #3
0
    def test_close_bugs_for_sourcepackagerelease_with_no_changes_file(self):
        # If there's no changes file it should read the changelog_entry on
        # the sourcepackagerelease.

        spr = self.factory.makeSourcePackageRelease(changelog_entry="blah")
        bugs = self.makeChangelogWithBugs(spr)

        # Call the method and test it's closed the bugs.
        close_bugs_for_sourcepackagerelease(
            spr.upload_distroseries, spr, None, since_version="1.0-1")
        for bug, bugtask in bugs:
            if bug.id != bugs[5][0].id:
                self.assertEqual(BugTaskStatus.FIXRELEASED, bugtask.status)
            else:
                self.assertEqual(BugTaskStatus.NEW, bugtask.status)
コード例 #4
0
    def test_close_bugs_for_sourcepackagerelease_with_no_changes_file(self):
        # If there's no changes file it should read the changelog_entry on
        # the sourcepackagerelease.

        spr = self.factory.makeSourcePackageRelease(changelog_entry="blah")
        bugs = self.makeChangelogWithBugs(spr)

        # Call the method and test it's closed the bugs.
        close_bugs_for_sourcepackagerelease(spr.upload_distroseries,
                                            spr,
                                            None,
                                            since_version="1.0-1")
        for bug, bugtask in bugs:
            if bug.id != bugs[5][0].id:
                self.assertEqual(BugTaskStatus.FIXRELEASED, bugtask.status)
            else:
                self.assertEqual(BugTaskStatus.NEW, bugtask.status)