Merge lp:~wallyworld/launchpad/reassign-reviewer-cancel-option into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Tim Penhey on 2010-09-28 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 11649 |
| Proposed branch: | lp:~wallyworld/launchpad/reassign-reviewer-cancel-option |
| Merge into: | lp:launchpad |
| Diff against target: |
99 lines (+30/-13) 2 files modified
lib/lp/code/browser/codereviewvote.py (+7/-2) lib/lp/code/browser/tests/test_codereviewvote.py (+23/-11) |
| To merge this branch: | bzr merge lp:~wallyworld/launchpad/reassign-reviewer-cancel-option |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Tim Penhey (community) | 2010-09-27 | Approve on 2010-09-28 | |
| Steve Kowalik (community) | code* | Approve on 2010-09-27 | |
| Launchpad code reviewers | code | 2010-09-26 | Pending |
|
Review via email:
|
|||
Commit Message
Add Cancel URL to the merge proposal Reassign Reviewer page
Description of the Change
Bug 640193 requires that a Cancel link be on the merge proposal Reassign Reviewer page.
Implementation
Simple fix - assign cancel_url in CodeReviewVoteR
Tests
test -vvt test_codereviewvote
Add new test_view_
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
| Tim Penhey (thumper) wrote : | # |
Steve, when reviewing browser we try to avoid overriding initialize unless it
is really necessary (I don't entirely recall why), and provide as much as we
can using properties.
Also when writing tests for views there is a very useful test method called:
create_
So... with these two thoughts in mind I have the following suggestions:
@property
def next_url(self):
return canonical_
cancel_url = next_url
This means that you don't have to override the initialize method.
Also in the test, you should never have any database IDs, like +merge/1.
Better to assert that the cancel_url matches the canonical_url of the merge
proposal.
self.
Also... use create_
view = create_
I also find the flow of the test a little harder to follow with the multiple
login commands. I think it would read slightly better to use
with_person_
already).
def test_view_
# Check that the cancel url exists.
bmp = self.factory.
reviewer = self.factory.
with person_
vote = bmp.nominateRev
with person_
view = create_
A side note: we often use comments instead of docstrings for the test methods
because it isn't always easy to get a single line to describe the test.
| Ian Booth (wallyworld) wrote : | # |
Thanks for the tips. I'll address the issues raised. The approach taken
was based on looking at what had been done previously for say
MergeProposalEd
and most other implementations use properties :-) Trust me to find as a
template to copy from the "wrong" one :-)
The structure of the test itself, with the multiple logins and use of
docstring etc, was based on the test case just above it, the only other
one in that test class. I thought it best to maintain implementation
consistency between the two test cases. What I'll look to do then is
refactor the existing test case as well so that they are both a)
implemented as per crrent best practice, and b) consistent.
On 28/09/10 08:24, Tim Penhey wrote:
> Review: Needs Fixing
> Steve, when reviewing browser we try to avoid overriding initialize unless it
> is really necessary (I don't entirely recall why), and provide as much as we
> can using properties.
>
> Also when writing tests for views there is a very useful test method called:
> create_
>
> So... with these two thoughts in mind I have the following suggestions:
>
> @property
> def next_url(self):
> return canonical_
>
> cancel_url = next_url
>
> This means that you don't have to override the initialize method.
>
> Also in the test, you should never have any database IDs, like +merge/1.
>
> Better to assert that the cancel_url matches the canonical_url of the merge
> proposal.
>
> self.assertEqua
>
> Also... use create_
>
> view = create_
>
> I also find the flow of the test a little harder to follow with the multiple
> login commands. I think it would read slightly better to use
> with_person_
> already).
>
> def test_view_
> # Check that the cancel url exists.
> bmp = self.factory.
> reviewer = self.factory.
> with person_
> vote = bmp.nominateRev
> reviewer=reviewer, registrant=
> with person_
> view = create_
> self.assertEqua
>
> A side note: we often use comments instead of docstrings for the test methods
> because it isn't always easy to get a single line to describe the test.
>

This change looks good to me.