コード例 #1
0
 def test_public_untagged(self):
     # Public untagged bugs show up in a single row, with both tag
     # and viewed_by = None.
     product = self.factory.makeProduct()
     bug = self.factory.makeBug(target=product).default_bugtask
     self.assertContentEqual(
         [(bug.status, None, bug.importance, False, None, None, None, 1)],
         calculate_bugsummary_rows(product))
コード例 #2
0
 def test_public_tagged(self):
     # Public tagged bugs show up in a row for each tag, plus an
     # untagged row.
     product = self.factory.makeProduct()
     bug = self.factory.makeBug(
         target=product, tags=[u'foo', u'bar']).default_bugtask
     self.assertContentEqual(
         [(bug.status, None, bug.importance, False, None, None, None, 1),
          (bug.status, None, bug.importance, False, u'foo', None, None, 1),
          (bug.status, None, bug.importance, False, u'bar', None, None, 1),
         ], calculate_bugsummary_rows(product))
コード例 #3
0
 def test_has_patch(self):
     # Bugs with a patch attachment (latest_patch_uploaded is not
     # None) have has_patch=True.
     product = self.factory.makeProduct()
     bug1 = self.factory.makeBug(target=product).default_bugtask
     self.factory.makeBugAttachment(bug=bug1.bug, is_patch=True)
     bug2 = self.factory.makeBug(
         target=product, status=BugTaskStatus.TRIAGED).default_bugtask
     self.assertContentEqual(
         [(bug1.status, None, bug1.importance, True, None, None, None, 1),
          (bug2.status, None, bug2.importance, False, None, None, None, 1)],
         calculate_bugsummary_rows(product))
コード例 #4
0
 def test_aggregation(self):
     # Multiple bugs with the same attributes appear in a single
     # aggregate row with an increased count.
     product = self.factory.makeProduct()
     bug1 = self.factory.makeBug(target=product).default_bugtask
     self.factory.makeBug(target=product).default_bugtask
     bug3 = self.factory.makeBug(
         target=product, status=BugTaskStatus.TRIAGED).default_bugtask
     self.assertContentEqual(
         [(bug1.status, None, bug1.importance, False, None, None, None, 2),
          (bug3.status, None, bug3.importance, False, None, None, None, 1)],
         calculate_bugsummary_rows(product))
コード例 #5
0
    def test_distribution_includes_packages(self):
        # Distribution and DistroSeries calculations include their
        # packages' bugs.
        dsp = self.factory.makeSourcePackage(
            publish=True).distribution_sourcepackage
        sp = self.factory.makeSourcePackage(publish=True)
        bug1 = self.factory.makeBugTask(target=dsp)
        bug1.transitionToStatus(BugTaskStatus.INVALID, bug1.owner)
        bug2 = self.factory.makeBugTask(target=sp)
        bug1.transitionToStatus(BugTaskStatus.CONFIRMED, bug2.owner)

        # The DistributionSourcePackage task shows up in the
        # Distribution's rows.
        self.assertContentEqual(
            [(bug1.status, None, bug1.importance, False, None, None, None, 1)],
            calculate_bugsummary_rows(dsp.distribution))
        self.assertContentEqual(
            calculate_bugsummary_rows(dsp.distribution),
            calculate_bugsummary_rows(dsp))

        # The SourcePackage task shows up in the DistroSeries' rows.
        self.assertContentEqual(
            [(bug2.status, None, bug2.importance, False, None, None, None, 1)],
            calculate_bugsummary_rows(sp.distroseries))
        self.assertContentEqual(
            calculate_bugsummary_rows(sp.distroseries),
            calculate_bugsummary_rows(sp))
コード例 #6
0
 def test_private_untagged(self):
     # Private untagged bugs show up with tag = None, viewed_by =
     # subscriber; and tag = None, access_policy = ap. There's no
     # viewed_by = None, access_policy = None row.
     product = self.factory.makeProduct()
     o = self.factory.makePerson()
     bug = self.factory.makeBug(
         target=product, owner=o,
         information_type=InformationType.USERDATA).default_bugtask
     [ap] = getUtility(IAccessPolicySource).find(
         [(product, InformationType.USERDATA)])
     self.assertContentEqual(
         [(bug.status, None, bug.importance, False, None, o.id, None, 1),
          (bug.status, None, bug.importance, False, None, None, ap.id, 1)],
         calculate_bugsummary_rows(product))
コード例 #7
0
 def test_milestone(self):
     # Milestoned bugs only show up with the milestone set.
     product = self.factory.makeProduct()
     mile1 = self.factory.makeMilestone(product=product)
     mile2 = self.factory.makeMilestone(product=product)
     bug1 = self.factory.makeBug(
         target=product, milestone=mile1).default_bugtask
     bug2 = self.factory.makeBug(
         target=product, milestone=mile2,
         status=BugTaskStatus.TRIAGED).default_bugtask
     self.assertContentEqual(
         [(bug1.status, mile1.id, bug1.importance, False, None, None, None,
           1),
          (bug2.status, mile2.id, bug2.importance, False, None, None, None,
           1)],
         calculate_bugsummary_rows(product))
コード例 #8
0
 def test_private_tagged(self):
     # Private tagged bugs show up with viewed_by = subscriber and
     # access_policy = ap rows, each with a row for each tag plus an
     # untagged row.
     product = self.factory.makeProduct()
     o = self.factory.makePerson()
     bug = self.factory.makeBug(
         target=product, owner=o, tags=[u'foo', u'bar'],
         information_type=InformationType.USERDATA).default_bugtask
     [ap] = getUtility(IAccessPolicySource).find(
         [(product, InformationType.USERDATA)])
     self.assertContentEqual(
         [(bug.status, None, bug.importance, False, None, o.id, None, 1),
          (bug.status, None, bug.importance, False, u'foo', o.id, None, 1),
          (bug.status, None, bug.importance, False, u'bar', o.id, None, 1),
          (bug.status, None, bug.importance, False, None, None, ap.id, 1),
          (bug.status, None, bug.importance, False, u'foo', None, ap.id, 1),
          (bug.status, None, bug.importance, False, u'bar', None, ap.id, 1),
         ],
         calculate_bugsummary_rows(product))