Merge lp:~thumper/launchpad/branch-no-active-reviews into lp:launchpad

Proposed by Tim Penhey
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: no longer in the source branch.
Merged at revision: 9739
Proposed branch: lp:~thumper/launchpad/branch-no-active-reviews
Merge into: lp:launchpad
Diff against target: 62 lines
2 files modified
lib/lp/code/browser/branchmergeproposallisting.py (+6/-0)
lib/lp/code/browser/tests/test_branchmergeproposallisting.py (+15/-0)
To merge this branch: bzr merge lp:~thumper/launchpad/branch-no-active-reviews
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+13610@code.launchpad.net

Commit message

Don't allow +activereviews for IBranch.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

A nice simple branch - hopefully.

Branches themselves shouldn't have +activereviews.

./bin/test -vvt test_no_active_reviews

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Yes, seems fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/branchmergeproposallisting.py'
2--- lib/lp/code/browser/branchmergeproposallisting.py 2009-10-01 11:21:31 +0000
3+++ lib/lp/code/browser/branchmergeproposallisting.py 2009-10-20 02:15:24 +0000
4@@ -17,6 +17,7 @@
5
6 from zope.component import getUtility
7 from zope.interface import implements, Interface
8+from zope.publisher.interfaces import NotFound
9 from zope.schema import Choice
10
11 from lazr.delegates import delegates
12@@ -30,6 +31,7 @@
13 from canonical.widgets import LaunchpadDropdownWidget
14
15 from lp.code.enums import BranchMergeProposalStatus, CodeReviewVote
16+from lp.code.interfaces.branch import IBranch
17 from lp.code.interfaces.branchcollection import (
18 IAllBranches, IBranchCollection)
19 from lp.code.interfaces.branchmergeproposal import (
20@@ -304,6 +306,10 @@
21 return self.user
22
23 def initialize(self):
24+ # Branches, despite implementing IHasMergeProposals, does not
25+ # have an active reviews page.
26+ if IBranch.providedBy(self.context):
27+ raise NotFound(self.context, '+activereviews')
28 # Work out the review groups
29 self.review_groups = {}
30 self.getter = getUtility(IBranchMergeProposalGetter)
31
32=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposallisting.py'
33--- lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2009-10-01 11:21:31 +0000
34+++ lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2009-10-20 02:15:24 +0000
35@@ -10,6 +10,7 @@
36
37 import pytz
38 import transaction
39+from zope.publisher.interfaces import NotFound
40 from zope.security.proxy import removeSecurityProxy
41
42 from canonical.launchpad.webapp.servers import LaunchpadTestRequest
43@@ -278,5 +279,19 @@
44 [item.context for item in view.review_groups[view.OTHER]])
45
46
47+class NoActiveReviewsForBranchTest(TestCaseWithFactory):
48+ """A branch should not have +activereviews."""
49+
50+ layer = DatabaseFunctionalLayer
51+
52+ def test_no_active_reviews(self):
53+ # 404 is more apt than an oops.
54+ branch = self.factory.makeProductBranch()
55+ self.assertRaises(
56+ NotFound,
57+ create_initialized_view,
58+ branch, name='+activereviews')
59+
60+
61 def test_suite():
62 return TestLoader().loadTestsFromName(__name__)