launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26856
[Merge] ~ilasc/launchpad:skip-bug-watch-owner-close-account into launchpad:master
Ioana Lasc has proposed merging ~ilasc/launchpad:skip-bug-watch-owner-close-account into launchpad:master.
Commit message:
Skip bugwatch owner when closing account
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/400856
Ran into this issue yesterday evening while attempting to delete a user in dogfood:
INFO Closing username-deactivatedaccount's account
ERROR User username-deactivatedaccount is still referenced by 5 bugwatch.owner values
ERROR User username-deactivatedaccount is still referenced
Running the unit test locally without the corresponding addition to the close account script fails with the same:
ERROR User person-name-100000 is still referenced by 2 bugwatch.owner values
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:skip-bug-watch-owner-close-account into launchpad:master.
diff --git a/lib/lp/registry/scripts/closeaccount.py b/lib/lp/registry/scripts/closeaccount.py
index af667a7..6fa8585 100644
--- a/lib/lp/registry/scripts/closeaccount.py
+++ b/lib/lp/registry/scripts/closeaccount.py
@@ -111,6 +111,7 @@ def close_account(username, log):
('bugnomination', 'owner'),
('bugtask', 'owner'),
('bugsubscription', 'subscribed_by'),
+ ('bugwatch', 'owner'),
('codeimport', 'owner'),
('codeimport', 'registrant'),
('codeimportjob', 'requesting_user'),
diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py
index c366539..33ccd7a 100644
--- a/lib/lp/registry/scripts/tests/test_closeaccount.py
+++ b/lib/lp/registry/scripts/tests/test_closeaccount.py
@@ -344,6 +344,17 @@ class TestCloseAccount(TestCaseWithFactory):
self.assertEqual(person, bug.owner)
self.assertEqual(person, bugtask.owner)
+ def test_skips_bug_watch_owner(self):
+ person = self.factory.makePerson()
+ self.factory.makeBugWatch(owner=person)
+ self.factory.makeBugWatch(owner=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)
+
def test_handles_bug_affects_person(self):
person = self.factory.makePerson()
bug = self.factory.makeBug()