launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #12525
[Merge] lp:~wallyworld/launchpad/rename-getSharedProducts into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/rename-getSharedProducts into lp:launchpad.
Commit message:
Renaming the sharing service getSharedProducts API to getSharedProjects.
Requested reviews:
Ian Booth (wallyworld)
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/rename-getSharedProducts/+merge/126569
Renaming the sharing service getSharedProducts API to getSharedProjects
--
https://code.launchpad.net/~wallyworld/launchpad/rename-getSharedProducts/+merge/126569
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-26 08:18:11 +0000
+++ lib/lp/registry/interfaces/sharingservice.py 2012-09-26 23:06:52 +0000
@@ -72,13 +72,13 @@
person=Reference(IPerson, title=_('Person'), required=True))
@operation_returns_collection_of(IProduct)
@operation_for_version('devel')
- def getSharedProducts(person, user):
- """Find products for which person has one or more access policy grants.
+ def getSharedProjects(person, user):
+ """Find projects for which person has one or more access policy grants.
:param user: the user making the request. If the user is an admin, then
- all products are returned, else only those for which the user is a
+ all projects are returned, else only those for which the user is a
maintainer or driver.
- :return: a collection of products
+ :return: a collection of projects
"""
@export_read_operation()
=== modified file 'lib/lp/registry/services/sharingservice.py'
--- lib/lp/registry/services/sharingservice.py 2012-09-26 08:18:11 +0000
+++ lib/lp/registry/services/sharingservice.py 2012-09-26 23:06:52 +0000
@@ -127,7 +127,7 @@
)
def _getSharedPillars(self, person, user, pillar_class, extra_filter=None):
- """Helper method for getSharedProducts and getSharedDistributions.
+ """Helper method for getSharedProjects and getSharedDistributions.
pillar_class is either Product or Distribution. Products define the
owner foreign key attribute as _owner so we need to account for that,
@@ -172,7 +172,7 @@
), filter)
return result_set
- def getSharedProducts(self, person, user):
+ def getSharedProjects(self, person, user):
"""See `ISharingService`."""
commercial_filter = None
if user and IPersonRoles(user).in_commercial_admin:
=== modified file 'lib/lp/registry/services/tests/test_sharingservice.py'
--- lib/lp/registry/services/tests/test_sharingservice.py 2012-09-26 08:18:11 +0000
+++ lib/lp/registry/services/tests/test_sharingservice.py 2012-09-26 23:06:52 +0000
@@ -1354,7 +1354,7 @@
self.assertContentEqual(branches[:9], shared_branches)
self.assertContentEqual(specs[:9], shared_specs)
- def _assert_getSharedProducts(self, product, who=None):
+ def _assert_getSharedProjects(self, product, who=None):
# Test that 'who' can query the shared products for a grantee.
# Make a product not related to 'who' which will be shared.
@@ -1373,7 +1373,7 @@
self.service.sharePillarInformation(
unrelated_product, person, unrelated_product.owner,
permissions)
- shared = self.service.getSharedProducts(person, who)
+ shared = self.service.getSharedProjects(person, who)
expected = []
if who:
expected = [product]
@@ -1381,55 +1381,55 @@
expected.append(unrelated_product)
self.assertEqual(expected, list(shared))
- def test_getSharedProducts_anonymous(self):
+ def test_getSharedProjects_anonymous(self):
# Anonymous users don't get to see any shared products.
product = self.factory.makeProduct()
- self._assert_getSharedProducts(product)
+ self._assert_getSharedProjects(product)
- def test_getSharedProducts_admin(self):
+ def test_getSharedProjects_admin(self):
# Admins can see all shared products.
admin = getUtility(ILaunchpadCelebrities).admin.teamowner
product = self.factory.makeProduct()
- self._assert_getSharedProducts(product, admin)
+ self._assert_getSharedProjects(product, admin)
- def test_getSharedProducts_commercial_admin_current(self):
+ def test_getSharedProjects_commercial_admin_current(self):
# Commercial admins can see all current commercial products.
admin = getUtility(ILaunchpadCelebrities).commercial_admin.teamowner
product = self.factory.makeProduct()
self.factory.makeCommercialSubscription(product)
- self._assert_getSharedProducts(product, admin)
+ self._assert_getSharedProjects(product, admin)
- def test_getSharedProducts_commercial_admin_expired(self):
+ def test_getSharedProjects_commercial_admin_expired(self):
# Commercial admins can see all expired commercial products.
admin = getUtility(ILaunchpadCelebrities).commercial_admin.teamowner
product = self.factory.makeProduct()
self.factory.makeCommercialSubscription(product, expired=True)
- self._assert_getSharedProducts(product, admin)
+ self._assert_getSharedProjects(product, admin)
- def test_getSharedProducts_commercial_admin_owner(self):
+ def test_getSharedProjects_commercial_admin_owner(self):
# Commercial admins can see products they own.
admin = getUtility(ILaunchpadCelebrities).commercial_admin
product = self.factory.makeProduct(owner=admin)
- self._assert_getSharedProducts(product, admin.teamowner)
+ self._assert_getSharedProjects(product, admin.teamowner)
- def test_getSharedProducts_commercial_admin_driver(self):
+ def test_getSharedProjects_commercial_admin_driver(self):
# Commercial admins can see products they are the driver for.
admin = getUtility(ILaunchpadCelebrities).commercial_admin
product = self.factory.makeProduct(driver=admin)
- self._assert_getSharedProducts(product, admin.teamowner)
+ self._assert_getSharedProjects(product, admin.teamowner)
- def test_getSharedProducts_owner(self):
+ def test_getSharedProjects_owner(self):
# Users only see shared products they own.
owner_team = self.factory.makeTeam(
membership_policy=TeamMembershipPolicy.MODERATED)
product = self.factory.makeProduct(owner=owner_team)
- self._assert_getSharedProducts(product, owner_team.teamowner)
+ self._assert_getSharedProjects(product, owner_team.teamowner)
- def test_getSharedProducts_driver(self):
+ def test_getSharedProjects_driver(self):
# Users only see shared products they are the driver for.
driver_team = self.factory.makeTeam()
product = self.factory.makeProduct(driver=driver_team)
- self._assert_getSharedProducts(product, driver_team.teamowner)
+ self._assert_getSharedProjects(product, driver_team.teamowner)
def _assert_getSharedDistributions(self, distro, who=None):
# Test that 'who' can query the shared distros for a grantee.
@@ -1883,10 +1883,10 @@
InformationType.USERDATA.title: SharingPermission.ALL.title}
)
- def test_getSharedProducts(self):
- # Test the exported getSharedProducts() method.
+ def test_getSharedProjects(self):
+ # Test the exported getSharedProjects() method.
ws_grantee = ws_object(self.launchpad, self.grantee)
- products = self.service.getSharedProducts(person=ws_grantee)
+ products = self.service.getSharedProjects(person=ws_grantee)
self.assertEqual(1, len(products))
self.assertEqual(products[0].name, self.pillar.name)
Follow ups