Merge lp://qastaging/~sinzui/launchpad/deactivate-deactivated-account-0 into lp://qastaging/launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 11337
Proposed branch: lp://qastaging/~sinzui/launchpad/deactivate-deactivated-account-0
Merge into: lp://qastaging/launchpad
Diff against target: 84 lines (+39/-7)
2 files modified
lib/lp/registry/browser/person.py (+7/-2)
lib/lp/registry/browser/tests/test_person_view.py (+32/-5)
To merge this branch: bzr merge lp://qastaging/~sinzui/launchpad/deactivate-deactivated-account-0
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+32264@code.qastaging.launchpad.net

Description of the change

This is my branch to fix the oops caused by users trying to deactivate their
already deactivated account.

    lp:~sinzui/launchpad/deactivate-deactivated-account-0
    Diff size: 85
    Launchpad bug:
          https://bugs.launchpad.net/bugs/583390
    Test command: ./bin/test -vv -t TestPersonDeactivateAccountView
    Pre-implementation: who
    Target release: 10.06

Do not let user try to deactivate their already deactivated account
--------------------------------------------------------------------

This oops happens when users are hacking the URL or using their browser
history to resubmit the form that deactivated their account in a false
hope that it doing it again will remove the page. The view must handle
this situation

Rules
-----

    * The view must verify the person is active before preceding to the
      deactivate step.

QA
--

    * On staging create a user
    * Visit the deactivate user page and open another tab to the page.
    * Deactivate the user
    * In the other tab deactivate the user
    * Verify you see a message explaining that the user is already deactivated.

Lint
----

Linting changed files:
  lib/lp/registry/browser/person.py
  lib/lp/registry/browser/tests/test_person_view.py

Test
----

    * lib/lp/registry/browser/tests/test_person_view.py
      * Added a basic test to verify that the TestPersonDeactivateAccountView
        works.
      * Added a test to show that an error is returned if the user is not
        Active.

Implementation
--------------

    * lib/lp/registry/browser/person.py
      * Added a validate method to TestPersonDeactivateAccountView to ensure
        non-active users are not deactivated.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Hi, this looks ok to me.

Nothing to do with your patch per se - I have a question about the
test technology being used: create_initialised_view - I presume that
that lets you get in under the publishing machinery?

That means that things setup by publications - like oops handling etc
- won't be notified properly? So I wonder what the advantages of it
are for testing, as it seems to diverge from production quite sharply.

-Rob

Revision history for this message
Curtis Hovey (sinzui) wrote :

This catches exceptions like other tests. The issue of recording an oops (which is an act of adaption) is a separate concern. I do not think TestBrowser records oopes either because it uses a similar mechanism to instantiate the view.

Revision history for this message
Robert Collins (lifeless) wrote :

Thanks!

Revision history for this message
Robert Collins (lifeless) wrote :

I forgot to vote.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.