Merge ~cristiangsp/launchpad:closeaccount-skip-pofile-owner into launchpad:master

Proposed by Cristian Gonzalez
Status: Merged
Approved by: Cristian Gonzalez
Approved revision: 00da470e5632f12dc4d086031db0dc9d87a1f0b4
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cristiangsp/launchpad:closeaccount-skip-pofile-owner
Merge into: launchpad:master
Diff against target: 34 lines (+12/-0)
2 files modified
lib/lp/registry/scripts/ (+1/-0)
lib/lp/registry/scripts/tests/ (+11/-0)
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email:

Commit message

Skip POFile.owner reference when running the close account script

Description of the change

It seems that the POFile.owner reference exists just for auditing purposes and there are not special privileges attached to it therefore it should be ok to include it in the skip list.

Regarding the unit test added, I have decided to set the ownership using "pofile.owner = person" as the owner parameter offered by the makePOFile is setting the POTemplate owner and not the POFile owner. Also other tests use this way too so probably not worht digging deeper on this now.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
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/ b/lib/lp/registry/scripts/
2index 419f99c..f488b78 100644
3--- a/lib/lp/registry/scripts/
4+++ b/lib/lp/registry/scripts/
5@@ -142,6 +142,7 @@ def close_account(username, log):
6 ('persontransferjob', 'minor_person'),
7 ('poexportrequest', 'person'),
8 ('pofile', 'lasttranslator'),
9+ ('pofile', 'owner'),
10 ('pofiletranslator', 'person'),
11 ('product', 'registrant'),
12 ('question', 'answerer'),
13diff --git a/lib/lp/registry/scripts/tests/ b/lib/lp/registry/scripts/tests/
14index b90a255..ada1dd5 100644
15--- a/lib/lp/registry/scripts/tests/
16+++ b/lib/lp/registry/scripts/tests/
17@@ -407,6 +407,17 @@ class TestCloseAccount(TestCaseWithFactory):
18 getUtility(IPOFileTranslatorSet).getForPersonPOFile(
19 person, pofile))
21+ def test_skips_po_file_owners(self):
22+ person = self.factory.makePerson()
23+ pofile = self.factory.makePOFile()
24+ pofile.owner = person
25+ person_id =
26+ account_id =
27+ script = self.makeScript([six.ensure_str(])
28+ with dbuser('launchpad'):
29+ self.runScript(script)
30+ self.assertRemoved(account_id, person_id)
32 def test_handles_archive_subscriptions_and_tokens(self):
33 person = self.factory.makePerson()
34 ppa = self.factory.makeArchive(private=True)


People subscribed via source and target branches

to status/vote changes: