← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ilasc/launchpad:add-codereviewvote-reviewer-close-account into launchpad:master

 

Ioana Lasc has proposed merging ~ilasc/launchpad:add-codereviewvote-reviewer-close-account into launchpad:master.

Commit message:
Add codereviewvote.reviewer to skip in close-account script

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/434174
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:add-codereviewvote-reviewer-close-account into launchpad:master.
diff --git a/lib/lp/registry/scripts/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
index df4c8ad..bb3c119 100644
--- a/lib/lp/registry/scripts/closeaccount.py
+++ b/lib/lp/registry/scripts/closeaccount.py
@@ -122,6 +122,7 @@ def close_account(username, log):
         ("codeimportjob", "requesting_user"),
         ("codeimportevent", "person"),
         ("codeimportresult", "requesting_user"),
+        ("codereviewvote", "reviewer"),
         ("distroarchseriesfilter", "creator"),
         ("faq", "last_updated_by"),
         ("featureflagchangelogentry", "person"),
diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
index f63aebf..5e6f5e9 100644
--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
@@ -22,7 +22,11 @@ from lp.app.interfaces.launchpad import ILaunchpadCelebrities
 from lp.archivepublisher.config import getPubConfig
 from lp.archivepublisher.publishing import Publisher
 from lp.bugs.model.bugsummary import BugSummary
-from lp.code.enums import CodeImportResultStatus, TargetRevisionControlSystems
+from lp.code.enums import (
+    CodeImportResultStatus,
+    CodeReviewVote,
+    TargetRevisionControlSystems,
+)
 from lp.code.interfaces.codeimportjob import ICodeImportJobWorkflow
 from lp.code.tests.helpers import GitHostingFixture
 from lp.registry.interfaces.person import IPersonSet
@@ -741,6 +745,22 @@ class TestCloseAccount(TestCaseWithFactory):
         self.assertRemoved(account_id, person_id)
         self.assertEqual(person, product.owner)
 
+    def test_skips_codereviewvote_reviewer(self):
+        person = self.factory.makePerson()
+        person_id = person.id
+        account_id = person.account.id
+        merge_proposal = self.factory.makeBranchMergeProposal(
+            reviewer=person, registrant=self.factory.makePerson()
+        )
+        merge_proposal.createComment(
+            person,
+            vote=CodeReviewVote.APPROVE,
+        )
+        script = self.makeScript([person.name])
+        with dbuser("launchpad"):
+            self.runScript(script)
+        self.assertRemoved(account_id, person_id)
+
     def test_skips_code_import(self):
         self.useFixture(GitHostingFixture())
         person = self.factory.makePerson()

References