← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/reexport-getSharedArtifacts-1046022 into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/reexport-getSharedArtifacts-1046022 into lp:launchpad.

Requested reviews:
  Ian Booth (wallyworld)
Related bugs:
  Bug #1046022 in Launchpad itself: "Cannot get the artifacts shared with a person over the API"
  https://bugs.launchpad.net/launchpad/+bug/1046022

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/reexport-getSharedArtifacts-1046022/+merge/124529

Reexport the sharing service getSharedArtifacts method. A previously landed branch removed this method from the web service and added getSharedBgs and getSharedBranches instead. But Cody would like to retain the originally exported method as well.
-- 
https://code.launchpad.net/~wallyworld/launchpad/reexport-getSharedArtifacts-1046022/+merge/124529
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/registry/interfaces/sharingservice.py'
--- lib/lp/registry/interfaces/sharingservice.py	2012-09-13 04:31:16 +0000
+++ lib/lp/registry/interfaces/sharingservice.py	2012-09-14 21:48:21 +0000
@@ -62,6 +62,12 @@
         information type.
         """
 
+    @export_read_operation()
+    @call_with(user=REQUEST_USER)
+    @operation_parameters(
+        pillar=Reference(IPillar, title=_('Pillar'), required=True),
+        person=Reference(IPerson, title=_('Person'), required=True))
+    @operation_for_version('devel')
     def getSharedArtifacts(pillar, person, user):
         """Return the artifacts shared between the pillar and person.
 

=== modified file 'lib/lp/registry/services/tests/test_sharingservice.py'
--- lib/lp/registry/services/tests/test_sharingservice.py	2012-09-13 04:31:16 +0000
+++ lib/lp/registry/services/tests/test_sharingservice.py	2012-09-14 21:48:21 +0000
@@ -1586,3 +1586,14 @@
             pillar=ws_pillar, person=ws_grantee)
         self.assertEqual(1, len(branches))
         self.assertEqual(branches[0].unique_name, self.branch.unique_name)
+
+    def test_getSharedArtifacts(self):
+        # Test the exported getSharedArtifacts() method.
+        ws_pillar = ws_object(self.launchpad, self.pillar)
+        ws_grantee = ws_object(self.launchpad, self.grantee)
+        (bugtasks, branches) = self.service.getSharedArtifacts(
+            pillar=ws_pillar, person=ws_grantee)
+        self.assertEqual(1, len(bugtasks))
+        self.assertEqual(1, len(branches))
+        self.assertEqual(bugtasks[0]['title'], self.bug.default_bugtask.title)
+        self.assertEqual(branches[0]['unique_name'], self.branch.unique_name)


Follow ups