← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/testfix-snap-personmerge into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/testfix-snap-personmerge into lp:launchpad.

Commit message:
Fix personmerge to handle renaming of ISnapSet.getByPerson to ISnapSet.findByPerson.

Requested reviews:
  Colin Watson (cjwatson)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/testfix-snap-personmerge/+merge/266729

Fix personmerge to handle renaming of ISnapSet.getByPerson to ISnapSet.findByPerson.
-- 
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/registry/personmerge.py'
--- lib/lp/registry/personmerge.py	2015-07-29 17:53:33 +0000
+++ lib/lp/registry/personmerge.py	2015-08-03 14:30:18 +0000
@@ -619,9 +619,9 @@
 
 def _mergeSnap(cur, from_person, to_person):
     # This shouldn't use removeSecurityProxy.
-    snaps = getUtility(ISnapSet).getByPerson(from_person)
+    snaps = getUtility(ISnapSet).findByPerson(from_person)
     existing_names = [
-        s.name for s in getUtility(ISnapSet).getByPerson(to_person)]
+        s.name for s in getUtility(ISnapSet).findByPerson(to_person)]
     for snap in snaps:
         new_name = snap.name
         count = 1

=== modified file 'lib/lp/registry/tests/test_personmerge.py'
--- lib/lp/registry/tests/test_personmerge.py	2015-07-29 22:00:19 +0000
+++ lib/lp/registry/tests/test_personmerge.py	2015-08-03 14:30:18 +0000
@@ -574,7 +574,7 @@
         self._do_premerge(duplicate, mergee)
         login_person(mergee)
         duplicate, mergee = self._do_merge(duplicate, mergee)
-        self.assertEqual(1, getUtility(ISnapSet).getByPerson(mergee).count())
+        self.assertEqual(1, getUtility(ISnapSet).findByPerson(mergee).count())
 
     def test_merge_with_duplicated_snaps(self):
         # If both the from and to people have snap packages with the same
@@ -592,7 +592,7 @@
         login_person(mergee)
         duplicate, mergee = self._do_merge(duplicate, mergee)
         snaps = sorted(
-            getUtility(ISnapSet).getByPerson(mergee), key=attrgetter("name"))
+            getUtility(ISnapSet).findByPerson(mergee), key=attrgetter("name"))
         self.assertEqual(2, len(snaps))
         self.assertIsNone(snaps[0].branch)
         self.assertEqual(ref.repository, snaps[0].git_repository)


Follow ups