← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ilasc/launchpad:skip-specification-owner into launchpad:master

 

Ioana Lasc has proposed merging ~ilasc/launchpad:skip-specification-owner into launchpad:master.

Commit message:
Skip specification owner for account closure

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/394890
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:skip-specification-owner into launchpad:master.
diff --git a/lib/lp/registry/scripts/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
index 208c3e7..8aa6121 100644
--- a/lib/lp/registry/scripts/closeaccount.py
+++ b/lib/lp/registry/scripts/closeaccount.py
@@ -153,6 +153,7 @@ def close_account(username, log):
         ('specification', 'goal_decider'),
         ('specification', 'goal_proposer'),
         ('specification', 'last_changed_by'),
+        ('specification', 'owner'),
         ('specification', 'starter'),
         ('structuralsubscription', 'subscribed_by'),
         ('teammembership', 'acknowledged_by'),
diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
index cee0fce..c8d01da 100644
--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
@@ -602,6 +602,17 @@ class TestCloseAccount(TestCaseWithFactory):
         self.assertEqual(person, code_imports[0].registrant)
         self.assertEqual(person, code_imports[1].registrant)
 
+    def test_skips_specification(self):
+        person = self.factory.makePerson()
+        person_id = person.id
+        account_id = person.account.id
+        specification = self.factory.makeSpecification(drafter=person)
+        script = self.makeScript([six.ensure_str(person.name)])
+        with dbuser('launchpad'):
+            self.runScript(script)
+        self.assertRemoved(account_id, person_id)
+        self.assertEqual(person, specification.drafter)
+
     def test_handles_login_token(self):
         person = self.factory.makePerson()
         email = '%s@xxxxxxxxxxxxxxxxxxx' % person.name