Merge ~ilasc/launchpad:skip-bugbranch-registrant-close-account into launchpad:master

Proposed by Ioana Lasc
Status: Merged
Approved by: Ioana Lasc
Approved revision: ab120917019d671250ffbafdfc84fe2628a1907f
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~ilasc/launchpad:skip-bugbranch-registrant-close-account
Merge into: launchpad:master
Diff against target: 35 lines (+13/-0)
2 files modified
lib/lp/registry/scripts/closeaccount.py (+1/-0)
lib/lp/registry/scripts/tests/test_closeaccount.py (+12/-0)
Reviewer Review Type Date Requested Status
Andrey Fedoseev (community) Approve
Review via email: mp+434172@code.launchpad.net

Commit message

Add Bugbranch.registrant to close-account script

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) wrote :

Running the test without adding the registrant to the skip clause fails with expected:

ERROR User person-name-100000 is still referenced by 1 bugbranch.registrant values

Revision history for this message
Andrey Fedoseev (andrey-fedoseev) :
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/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
2index df4c8ad..ede97d9 100644
3--- a/lib/lp/registry/scripts/closeaccount.py
4+++ b/lib/lp/registry/scripts/closeaccount.py
5@@ -112,6 +112,7 @@ def close_account(username, log):
6 ("bug", "owner"),
7 ("bug", "who_made_private"),
8 ("bugactivity", "person"),
9+ ("bugbranch", "registrant"),
10 ("bugnomination", "decider"),
11 ("bugnomination", "owner"),
12 ("bugtask", "owner"),
13diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
14index f63aebf..9640117 100644
15--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
16+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
17@@ -317,6 +317,18 @@ class TestCloseAccount(TestCaseWithFactory):
18 self.runScript(script)
19 self.assertRemoved(account_id, person_id)
20
21+ def test_skips_bugbranch_registrant(self):
22+ person = self.factory.makePerson()
23+ person_id = person.id
24+ account_id = person.account.id
25+ bug = self.factory.makeBug()
26+ branch = self.factory.makeBranch()
27+ bug.linkBranch(branch, person)
28+ script = self.makeScript([person.name])
29+ with dbuser("launchpad"):
30+ self.runScript(script)
31+ self.assertRemoved(account_id, person_id)
32+
33 def test_handles_packaging_references(self):
34 person = self.factory.makePerson()
35 person_id = person.id

Subscribers

People subscribed via source and target branches

to status/vote changes: