← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ilasc/launchpad:skip-specificationbranch-registrant-in-close-account-script into launchpad:master

 

Ioana Lasc has proposed merging ~ilasc/launchpad:skip-specificationbranch-registrant-in-close-account-script into launchpad:master.

Commit message:
Skip registrant of specificationbranch in close-account script

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/406711
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:skip-specificationbranch-registrant-in-close-account-script into launchpad:master.
diff --git a/lib/lp/registry/scripts/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
index b4e505b..8877204 100644
--- a/lib/lp/registry/scripts/closeaccount.py
+++ b/lib/lp/registry/scripts/closeaccount.py
@@ -184,6 +184,8 @@ def close_account(username, log):
         # deal with due to the size and complexity of references to it.  We
         # can hopefully provide a garbo job for this eventually.
         ('revisionauthor', 'person'),
+
+        ('specificationbranch', 'registrant'),
         }
 
     # If all the teams that the user owns
diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
index 205ef41..f729613 100644
--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
@@ -303,6 +303,18 @@ class TestCloseAccount(TestCaseWithFactory):
             self.assertEqual(question_status, question.status)
             self.assertIsNone(question.whiteboard)
 
+    def test_skips_specification_branch_registrant(self):
+        person = self.factory.makePerson()
+        person_id = person.id
+        account_id = person.account.id
+        spec = self.factory.makeSpecification()
+        branch = self.factory.makeAnyBranch()
+        spec.linkBranch(branch, person)
+        script = self.makeScript([six.ensure_str(person.name)])
+        with dbuser('launchpad'):
+            self.runScript(script)
+        self.assertRemoved(account_id, person_id)
+
     def test_handles_packaging_references(self):
         person = self.factory.makePerson()
         person_id = person.id

Follow ups