launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03567
[Merge] lp:~benji/launchpad/bug-778689 into lp:launchpad
Benji York has proposed merging lp:~benji/launchpad/bug-778689 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~benji/launchpad/bug-778689/+merge/60520
This branch fixes bug 778689. There was no test coverage for a menu
mixin when viewing project group milestones and the code couldn't handle
it.
The fix was simple: since subscribing to project group milestones isn't
allowed, just disable the links.
The related tests can be run with:
bin/test -c -m lp.registry.browser.tests.test_subscription_links
The make lint report is clean:
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/bugs/browser/structuralsubscription.py
lib/lp/registry/browser/tests/test_subscription_links.py
--
https://code.launchpad.net/~benji/launchpad/bug-778689/+merge/60520
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~benji/launchpad/bug-778689 into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/structuralsubscription.py'
--- lib/lp/bugs/browser/structuralsubscription.py 2011-05-03 13:38:30 +0000
+++ lib/lp/bugs/browser/structuralsubscription.py 2011-05-10 15:29:27 +0000
@@ -381,6 +381,11 @@
bug subscriptions.
"""
sst = self._getSST()
+ # ProjectGroup milestones aren't really structural subscription
+ # targets as they're not real milestones, so you can't subscribe to
+ # them.
+ if IProjectGroupMilestone.providedBy(sst):
+ return False
pillar = IStructuralSubscriptionTargetHelper(sst).pillar
return (pillar.bug_tracking_usage == ServiceUsage.LAUNCHPAD and
sst.userCanAlterBugSubscription(self.user, self.user))
=== modified file 'lib/lp/registry/browser/tests/test_subscription_links.py'
--- lib/lp/registry/browser/tests/test_subscription_links.py 2011-04-25 18:13:31 +0000
+++ lib/lp/registry/browser/tests/test_subscription_links.py 2011-05-10 15:29:27 +0000
@@ -15,7 +15,11 @@
from canonical.launchpad.testing.pages import first_tag_by_class
from canonical.testing.layers import DatabaseFunctionalLayer
+from lp.bugs.browser.structuralsubscription import (
+ StructuralSubscriptionMenuMixin,
+ )
from lp.registry.interfaces.person import IPersonSet
+from lp.registry.model.milestone import ProjectMilestone
from lp.services.features.testing import FeatureFixture
from lp.testing import (
celebrity_logged_in,
@@ -175,6 +179,21 @@
project=self.target, official_malone=True)
+class ProjectGroupMilestone(TestCaseWithFactory):
+ """Make sure that projects' "virtual" milestones don't break things."""
+
+ layer = DatabaseFunctionalLayer
+
+ def test_for_bug_778689(self):
+ with person_logged_in(self.factory.makePerson()):
+ project = self.factory.makeProject()
+ product = self.factory.makeProduct(project=project)
+ mixin = StructuralSubscriptionMenuMixin()
+ mixin.context = ProjectMilestone(project, '11.04', None, True)
+ # Before bug 778689 was fixed, this would raise an exception.
+ mixin._enabled
+
+
class ProjectGroupBugs(ProjectGroupView):
"""Test structural subscriptions on the project group bugs view."""