Exemplo n.º 1
0
 def test_milestone_target(self):
     actor = self.factory.makePerson()
     login_person(actor)
     product = self.factory.makeProduct()
     milestone = self.factory.makeMilestone(product=product)
     bug = self.factory.makeBug(target=product, milestone=milestone)
     bugtask = bug.bugtasks[0]
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(set(result),
                      set(((bugtask, product), (bugtask, milestone))))
 def test_milestone_target(self):
     actor = self.factory.makePerson()
     login_person(actor)
     product = self.factory.makeProduct()
     milestone = self.factory.makeMilestone(product=product)
     bug = self.factory.makeBug(target=product, milestone=milestone)
     bugtask = bug.bugtasks[0]
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(set(result), set(
         ((bugtask, product), (bugtask, milestone))))
 def test_sourcepackage_target(self):
     actor = self.factory.makePerson()
     login_person(actor)
     distroseries = self.factory.makeDistroSeries()
     sourcepackage = self.factory.makeSourcePackage(
         distroseries=distroseries, publish=True)
     product = self.factory.makeProduct()
     bug = self.factory.makeBug(target=product)
     bug.addTask(actor, sourcepackage)
     product_bugtask = bug.bugtasks[0]
     sourcepackage_bugtask = bug.bugtasks[1]
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(set(result), set(
         ((product_bugtask, product),
          (sourcepackage_bugtask, distroseries))))
 def test_product_with_project_group(self):
     # get_structural_subscription_targets() will yield both a
     # product and its parent project group if it has one.
     project = self.factory.makeProject()
     product = self.factory.makeProduct(
         project=project, owner=project.owner)
     subscriber = self.factory.makePerson()
     with person_logged_in(subscriber):
         project.addBugSubscription(subscriber, subscriber)
     # This is a sanity check.
     self.assertEqual(project, product.parent_subscription_target)
     bug = self.factory.makeBug(target=product)
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(
         set([(bug.bugtasks[0], product), (bug.bugtasks[0], project)]),
         set(result))
 def test_distribution_source_package_target(self):
     actor = self.factory.makePerson()
     login_person(actor)
     distribution = self.factory.makeDistribution()
     dist_sourcepackage = self.factory.makeDistributionSourcePackage(
         distribution=distribution)
     product = self.factory.makeProduct()
     bug = self.factory.makeBug(target=product)
     bug.addTask(actor, dist_sourcepackage)
     product_bugtask = bug.bugtasks[0]
     dist_sourcepackage_bugtask = bug.bugtasks[1]
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(set(result), set(
         ((product_bugtask, product),
          (dist_sourcepackage_bugtask, dist_sourcepackage),
          (dist_sourcepackage_bugtask, distribution))))
Exemplo n.º 6
0
 def test_product_with_project_group(self):
     # get_structural_subscription_targets() will yield both a
     # product and its parent project group if it has one.
     project = self.factory.makeProject()
     product = self.factory.makeProduct(project=project,
                                        owner=project.owner)
     subscriber = self.factory.makePerson()
     with person_logged_in(subscriber):
         project.addBugSubscription(subscriber, subscriber)
     # This is a sanity check.
     self.assertEqual(project, product.parent_subscription_target)
     bug = self.factory.makeBug(target=product)
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(
         set([(bug.bugtasks[0], product), (bug.bugtasks[0], project)]),
         set(result))
Exemplo n.º 7
0
 def test_sourcepackage_target(self):
     actor = self.factory.makePerson()
     login_person(actor)
     distroseries = self.factory.makeDistroSeries()
     sourcepackage = self.factory.makeSourcePackage(
         distroseries=distroseries, publish=True)
     product = self.factory.makeProduct()
     bug = self.factory.makeBug(target=product)
     bug.addTask(actor, sourcepackage)
     product_bugtask = bug.bugtasks[0]
     sourcepackage_bugtask = bug.bugtasks[1]
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(
         set(result),
         set(((product_bugtask, product), (sourcepackage_bugtask,
                                           distroseries))))
Exemplo n.º 8
0
 def test_distribution_source_package_target(self):
     actor = self.factory.makePerson()
     login_person(actor)
     distribution = self.factory.makeDistribution()
     dist_sourcepackage = self.factory.makeDistributionSourcePackage(
         distribution=distribution)
     product = self.factory.makeProduct()
     bug = self.factory.makeBug(target=product)
     bug.addTask(actor, dist_sourcepackage)
     product_bugtask = bug.bugtasks[0]
     dist_sourcepackage_bugtask = bug.bugtasks[1]
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(
         set(result),
         set(((product_bugtask, product), (dist_sourcepackage_bugtask,
                                           dist_sourcepackage),
              (dist_sourcepackage_bugtask, distribution))))
 def test_product_target(self):
     product = self.factory.makeProduct()
     bug = self.factory.makeBug(target=product)
     bugtask = bug.bugtasks[0]
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(list(result), [(bugtask, product)])
Exemplo n.º 10
0
 def test_product_target(self):
     product = self.factory.makeProduct()
     bug = self.factory.makeBug(target=product)
     bugtask = bug.bugtasks[0]
     result = get_structural_subscription_targets(bug.bugtasks)
     self.assertEqual(list(result), [(bugtask, product)])