launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #09128
[Merge] lp:~replaceafill/launchpad/bug-210821 into lp:launchpad
Douglas Cerna has proposed merging lp:~replaceafill/launchpad/bug-210821 into lp:launchpad.
Requested reviews:
Curtis Hovey (sinzui)
For more details, see:
https://code.launchpad.net/~replaceafill/launchpad/bug-210821/+merge/111659
Filtered inactive products and projects out of pillars list for bug tracker sets.
--
https://code.launchpad.net/~replaceafill/launchpad/bug-210821/+merge/111659
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/bugs/model/bugtracker.py'
--- lib/lp/bugs/model/bugtracker.py 2011-12-30 06:14:56 +0000
+++ lib/lp/bugs/model/bugtracker.py 2012-06-22 18:30:33 +0000
@@ -845,9 +845,11 @@
from lp.registry.model.projectgroup import ProjectGroup
ids = [str(b.id) for b in bugtrackers]
products = Product.select(
- "bugtracker in (%s)" % ",".join(ids), orderBy="name")
+ "bugtracker in (%s) AND active IS True" %
+ ",".join(ids), orderBy="name")
projects = ProjectGroup.select(
- "bugtracker in (%s)" % ",".join(ids), orderBy="name")
+ "bugtracker in (%s) AND active IS True" %
+ ",".join(ids), orderBy="name")
ret = {}
for product in products:
ret.setdefault(product.bugtracker, []).append(product)
=== modified file 'lib/lp/bugs/tests/test_bugtracker.py'
--- lib/lp/bugs/tests/test_bugtracker.py 2012-01-01 02:58:52 +0000
+++ lib/lp/bugs/tests/test_bugtracker.py 2012-06-22 18:30:33 +0000
@@ -77,6 +77,29 @@
# but not in active.
self.assertFalse(tracker in trackers.trackers(active=True))
+ def test_inactive_products_in_pillars(self):
+ # the list of pillars should only contain active
+ # products and projects
+ tracker = self.factory.makeBugTracker()
+ trackers = BugTrackerSet()
+ product1 = self.factory.makeProduct()
+ product2 = self.factory.makeProduct()
+ project1 = self.factory.makeProject()
+ project2 = self.factory.makeProject()
+ login(ADMIN_EMAIL)
+ product1.bugtracker = tracker
+ product2.bugtracker = tracker
+ project1.bugtracker = tracker
+ project2.bugtracker = tracker
+ pillars = trackers.getPillarsForBugtrackers(trackers)
+ self.assertContentEqual(
+ [product1, product2, project1, project2], pillars[tracker])
+ product1.active = False
+ project2.active = False
+ pillars = trackers.getPillarsForBugtrackers(trackers)
+ self.assertContentEqual(
+ [product2, project1], pillars[tracker])
+
class BugTrackerTestCase(TestCaseWithFactory):
"""Unit tests for the `BugTracker` class."""
Follow ups