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
diff --git a/lib/lp/registry/scripts/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
index df4c8ad..ede97d9 100644
--- a/lib/lp/registry/scripts/closeaccount.py
+++ b/lib/lp/registry/scripts/closeaccount.py
@@ -112,6 +112,7 @@ def close_account(username, log):
112 ("bug", "owner"),112 ("bug", "owner"),
113 ("bug", "who_made_private"),113 ("bug", "who_made_private"),
114 ("bugactivity", "person"),114 ("bugactivity", "person"),
115 ("bugbranch", "registrant"),
115 ("bugnomination", "decider"),116 ("bugnomination", "decider"),
116 ("bugnomination", "owner"),117 ("bugnomination", "owner"),
117 ("bugtask", "owner"),118 ("bugtask", "owner"),
diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
index f63aebf..9640117 100644
--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
@@ -317,6 +317,18 @@ class TestCloseAccount(TestCaseWithFactory):
317 self.runScript(script)317 self.runScript(script)
318 self.assertRemoved(account_id, person_id)318 self.assertRemoved(account_id, person_id)
319319
320 def test_skips_bugbranch_registrant(self):
321 person = self.factory.makePerson()
322 person_id = person.id
323 account_id = person.account.id
324 bug = self.factory.makeBug()
325 branch = self.factory.makeBranch()
326 bug.linkBranch(branch, person)
327 script = self.makeScript([person.name])
328 with dbuser("launchpad"):
329 self.runScript(script)
330 self.assertRemoved(account_id, person_id)
331
320 def test_handles_packaging_references(self):332 def test_handles_packaging_references(self):
321 person = self.factory.makePerson()333 person = self.factory.makePerson()
322 person_id = person.id334 person_id = person.id

Subscribers

People subscribed via source and target branches

to status/vote changes: