Merge ~ilasc/launchpad:skip-specificationbranch-registrant-in-close-account-script into launchpad:master

Proposed by Ioana Lasc
Status: Merged
Approved by: Ioana Lasc
Approved revision: fcbf227215d27fe7e338c07dc9c070bf6733b347
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~ilasc/launchpad:skip-specificationbranch-registrant-in-close-account-script
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
Colin Watson (community) Approve
Review via email: mp+406711@code.launchpad.net

Commit message

Skip registrant of specificationbranch in close-account script

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

Tested that without this alteration the current script fails as expected:

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

Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Ioana Lasc (ilasc) :
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/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
2index b4e505b..3130cd5 100644
3--- a/lib/lp/registry/scripts/closeaccount.py
4+++ b/lib/lp/registry/scripts/closeaccount.py
5@@ -162,6 +162,7 @@ def close_account(username, log):
6 ('specification', 'last_changed_by'),
7 ('specification', 'owner'),
8 ('specification', 'starter'),
9+ ('specificationbranch', 'registrant'),
10 ('structuralsubscription', 'subscribed_by'),
11 ('teammembership', 'acknowledged_by'),
12 ('teammembership', 'last_changed_by'),
13diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
14index 205ef41..f729613 100644
15--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
16+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
17@@ -303,6 +303,18 @@ class TestCloseAccount(TestCaseWithFactory):
18 self.assertEqual(question_status, question.status)
19 self.assertIsNone(question.whiteboard)
20
21+ def test_skips_specification_branch_registrant(self):
22+ person = self.factory.makePerson()
23+ person_id = person.id
24+ account_id = person.account.id
25+ spec = self.factory.makeSpecification()
26+ branch = self.factory.makeAnyBranch()
27+ spec.linkBranch(branch, person)
28+ script = self.makeScript([six.ensure_str(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: