← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/close-account-bugnomination-owner into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/close-account-bugnomination-owner into lp:launchpad.

Commit message:
Skip BugNomination.owner in close-account.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/close-account-bugnomination-owner/+merge/366285

The fact that a user made some bug nominations shouldn't stop us closing their account.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/close-account-bugnomination-owner into lp:launchpad.
=== modified file 'lib/lp/registry/scripts/closeaccount.py'
--- lib/lp/registry/scripts/closeaccount.py	2019-03-21 17:37:19 +0000
+++ lib/lp/registry/scripts/closeaccount.py	2019-04-18 16:14:53 +0000
@@ -98,6 +98,7 @@
         ('bug', 'who_made_private'),
         ('bugactivity', 'person'),
         ('bugnomination', 'decider'),
+        ('bugnomination', 'owner'),
         ('bugtask', 'owner'),
         ('bugsubscription', 'subscribed_by'),
         ('faq', 'last_updated_by'),

=== modified file 'lib/lp/registry/scripts/tests/test_closeaccount.py'
--- lib/lp/registry/scripts/tests/test_closeaccount.py	2019-03-21 17:37:19 +0000
+++ lib/lp/registry/scripts/tests/test_closeaccount.py	2019-04-18 16:14:53 +0000
@@ -448,3 +448,25 @@
             BugSummary.viewed_by_id.is_in([person.id, other_person.id])))
         self.assertThat(summaries, MatchesSetwise(
             MatchesStructure.byEquality(viewed_by=other_person)))
+
+    def test_skips_bug_nomination(self):
+        person = self.factory.makePerson()
+        other_person = self.factory.makePerson()
+        bug = self.factory.makeBug()
+        targets = [self.factory.makeProductSeries() for _ in range(2)]
+        self.factory.makeBugTask(bug=bug, target=targets[0].parent)
+        bug.addNomination(person, targets[0])
+        self.factory.makeBugTask(bug=bug, target=targets[1].parent)
+        bug.addNomination(other_person, targets[1])
+        self.assertThat(bug.getNominations(), MatchesSetwise(
+            MatchesStructure.byEquality(owner=person),
+            MatchesStructure.byEquality(owner=other_person)))
+        person_id = person.id
+        account_id = person.account.id
+        script = self.makeScript([six.ensure_str(person.name)])
+        with dbuser('launchpad'):
+            self.runScript(script)
+        self.assertRemoved(account_id, person_id)
+        self.assertThat(bug.getNominations(), MatchesSetwise(
+            MatchesStructure.byEquality(owner=person),
+            MatchesStructure.byEquality(owner=other_person)))


Follow ups