← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~clinton-fung/launchpad:account-deletion-codereviewvote-registrant-skip into launchpad:master

 

Clinton Fung has proposed merging ~clinton-fung/launchpad:account-deletion-codereviewvote-registrant-skip into launchpad:master.

Commit message:
Add a skip for codereviewvote.registrant to allow account closure to proceed

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~clinton-fung/launchpad/+git/launchpad/+merge/437125

Found another case where account closure fails to proceed because the account to be closed is associated with a review as the registrant of the review. Skip this case.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~clinton-fung/launchpad:account-deletion-codereviewvote-registrant-skip into launchpad:master.
diff --git a/lib/lp/registry/scripts/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
index cb2bf4f..2a5657a 100644
--- a/lib/lp/registry/scripts/closeaccount.py
+++ b/lib/lp/registry/scripts/closeaccount.py
@@ -123,6 +123,7 @@ def close_account(username, log):
         ("codeimportjob", "requesting_user"),
         ("codeimportevent", "person"),
         ("codeimportresult", "requesting_user"),
+        ("codereviewvote", "registrant"),
         ("codereviewvote", "reviewer"),
         ("distroarchseriesfilter", "creator"),
         ("faq", "last_updated_by"),
diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
index c1270d4..8e2292b 100644
--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
@@ -1315,3 +1315,13 @@ class TestCloseAccount(TestCaseWithFactory):
         with dbuser("launchpad"):
             self.runScript(script)
         self.assertRemoved(account_id, person_id)
+
+    def test_skips_codereviewvote_registrant(self):
+        vote = self.factory.makeCodeReviewVoteReference()
+        registrant = vote.registrant
+        registrant_account_id = registrant.account.id
+        registrant_id = registrant.id
+        script = self.makeScript([registrant.name])
+        with dbuser("launchpad"):
+            self.runScript(script)
+        self.assertRemoved(registrant_account_id, registrant_id)