← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/reassign-reviewer-cancel-option into lp:launchpad/devel

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/reassign-reviewer-cancel-option into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers): code


Bug 640193 requires that a Cancel link be on the merge proposal Reassign Reviewer page.

Implementation

    Simple fix - assign cancel_url in CodeReviewVoteReassign initialize() method. Also a few drive-by lint fixes.

Tests

    test -vvt test_codereviewvote

    Add new test_view_attributes() test to test_codereviewvote.py

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/code/browser/codereviewvote.py
  lib/lp/code/browser/tests/test_codereviewvote.py

-- 
https://code.launchpad.net/~wallyworld/launchpad/reassign-reviewer-cancel-option/+merge/36671
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/reassign-reviewer-cancel-option into lp:launchpad/devel.
=== modified file 'lib/lp/code/browser/codereviewvote.py'
--- lib/lp/code/browser/codereviewvote.py	2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/codereviewvote.py	2010-09-26 22:36:51 +0000
@@ -24,7 +24,7 @@
 class ReassignSchema(Interface):
     """Schema to use when reassigning the reviewer for a requested review."""
 
-    reviewer = PublicPersonChoice( title=_('Reviewer'), required=True,
+    reviewer = PublicPersonChoice(title=_('Reviewer'), required=True,
             description=_('A person who you want to review this.'),
             vocabulary='ValidPersonOrTeam')
 
@@ -36,11 +36,15 @@
 
     page_title = label = 'Reassign review request'
 
+    def initialize(self):
+        self.cancel_url = (canonical_url(self.context.branch_merge_proposal))
+        self.next_url = self.cancel_url
+        super(CodeReviewVoteReassign, self).initialize()
+
     @action('Reassign', name='reassign')
     def reassign_action(self, action, data):
         """Use the form data to change the review request reviewer."""
         self.context.reassignReview(data['reviewer'])
-        self.next_url = canonical_url(self.context.branch_merge_proposal)
 
     def validate(self, data):
         """Make sure that the reassignment can happen."""

=== modified file 'lib/lp/code/browser/tests/test_codereviewvote.py'
--- lib/lp/code/browser/tests/test_codereviewvote.py	2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/tests/test_codereviewvote.py	2010-09-26 22:36:51 +0000
@@ -1,10 +1,8 @@
 # Copyright 2009 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-
 """Unit tests for CodeReviewVoteReferences."""
 
-
 __metaclass__ = type
 
 
@@ -37,6 +35,21 @@
         view.reassign_action.success({'reviewer': new_reviewer})
         self.assertEqual(vote.reviewer, new_reviewer)
 
+    def test_view_attributes(self):
+        """Check various urls etc on view are correct."""
+        bmp = self.factory.makeBranchMergeProposal()
+        reviewer = self.factory.makePerson()
+        login_person(bmp.registrant)
+        vote = bmp.nominateReviewer(
+            reviewer=reviewer, registrant=bmp.registrant)
+        login_person(reviewer)
+        view = CodeReviewVoteReassign(vote, LaunchpadTestRequest())
+        view.initialize()
+        required_cancel_url = (
+            "http://code.launchpad.dev/%s/+merge/1";
+            % bmp.source_branch.unique_name)
+        self.assertEqual(required_cancel_url, view.cancel_url)
+
 
 def test_suite():
     return unittest.TestLoader().loadTestsFromName(__name__)


Follow ups