← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ilasc/launchpad:add-potemplate-owner-close-account into launchpad:master

 

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

Commit message:
Add potemplate.owner to close-account script

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/434185
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:add-potemplate-owner-close-account into launchpad:master.
diff --git a/lib/lp/registry/scripts/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
index df4c8ad..e2eec8e 100644
--- a/lib/lp/registry/scripts/closeaccount.py
+++ b/lib/lp/registry/scripts/closeaccount.py
@@ -145,6 +145,7 @@ def close_account(username, log):
         ("pofile", "lasttranslator"),
         ("pofile", "owner"),
         ("pofiletranslator", "person"),
+        ("potemplate", "owner"),
         ("product", "registrant"),
         ("question", "answerer"),
         ("questionreopening", "answerer"),
diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
index f63aebf..ce8c441 100644
--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
@@ -426,6 +426,20 @@ class TestCloseAccount(TestCaseWithFactory):
             self.runScript(script)
         self.assertRemoved(account_id, person_id)
 
+    def test_skips_po_template_owners(self):
+        person = self.factory.makePerson()
+        productseries = self.factory.makeProductSeries()
+        potemplate = self.factory.makePOTemplate(
+            owner=person, productseries=productseries
+        )
+        potemplate.owner = person
+        person_id = person.id
+        account_id = person.account.id
+        script = self.makeScript([person.name])
+        with dbuser("launchpad"):
+            self.runScript(script)
+        self.assertRemoved(account_id, person_id)
+
     def test_handles_archive_subscriptions_and_tokens(self):
         person = self.factory.makePerson()
         ppa = self.factory.makeArchive(private=True)

References