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

Proposed by Clinton Fung
Status: Merged
Approved by: Clinton Fung
Approved revision: 279feb00a16bea0fb2c88f2c7a7f7f6034b63744
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~clinton-fung/launchpad:account-deletion-codereviewvote-registrant-skip
Merge into: launchpad:master
Diff against target: 30 lines (+11/-0)
2 files modified
lib/lp/registry/scripts/closeaccount.py (+1/-0)
lib/lp/registry/scripts/tests/test_closeaccount.py (+10/-0)
Reviewer Review Type Date Requested Status
Guruprasad Approve
Review via email: mp+437125@code.launchpad.net

Commit message

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

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Guruprasad (lgp171188) wrote :

LGTM 👍

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/registry/scripts/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
2index cb2bf4f..2a5657a 100644
3--- a/lib/lp/registry/scripts/closeaccount.py
4+++ b/lib/lp/registry/scripts/closeaccount.py
5@@ -123,6 +123,7 @@ def close_account(username, log):
6 ("codeimportjob", "requesting_user"),
7 ("codeimportevent", "person"),
8 ("codeimportresult", "requesting_user"),
9+ ("codereviewvote", "registrant"),
10 ("codereviewvote", "reviewer"),
11 ("distroarchseriesfilter", "creator"),
12 ("faq", "last_updated_by"),
13diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
14index c1270d4..8e2292b 100644
15--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
16+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
17@@ -1315,3 +1315,13 @@ class TestCloseAccount(TestCaseWithFactory):
18 with dbuser("launchpad"):
19 self.runScript(script)
20 self.assertRemoved(account_id, person_id)
21+
22+ def test_skips_codereviewvote_registrant(self):
23+ vote = self.factory.makeCodeReviewVoteReference()
24+ registrant = vote.registrant
25+ registrant_account_id = registrant.account.id
26+ registrant_id = registrant.id
27+ script = self.makeScript([registrant.name])
28+ with dbuser("launchpad"):
29+ self.runScript(script)
30+ self.assertRemoved(registrant_account_id, registrant_id)

Subscribers

People subscribed via source and target branches

to status/vote changes: