Repository: googleapis/google-cloud-python

Issue:
Should 'topics.testIamPermissions' be wrapped as 'check_iam_permissions'?
See: https://github.com/GoogleCloudPlatform/gcloud-python/pull/1642#discussion_r57048424 and ff.

Likewise `subscriptions.testIamPermission`.

@jgeewax if you decide so, please assign the issue to me;  otherwise, just close it.



Discussion:
I'm a fan of `check` unless we have an awesome reason not to...


Resolving patch:
diff --git a/gcloud/pubsub/subscription.py b/gcloud/pubsub/subscription.py
--- a/gcloud/pubsub/subscription.py
+++ b/gcloud/pubsub/subscription.py
@@ -309,8 +309,8 @@ def set_iam_policy(self, policy, client=None):
             method='POST', path=path, data=resource)
         return Policy.from_api_repr(resp)
 
-    def test_iam_permissions(self, permissions, client=None):
-        """Permissions allowed for the current user by the effective IAM policy.
+    def check_iam_permissions(self, permissions, client=None):
+        """Verify permissions allowed for the current user.
 
         See:
         https://cloud.google.com/pubsub/reference/rest/v1/projects.subscriptions/testIamPermissions
diff --git a/gcloud/pubsub/topic.py b/gcloud/pubsub/topic.py
--- a/gcloud/pubsub/topic.py
+++ b/gcloud/pubsub/topic.py
@@ -303,8 +303,8 @@ def set_iam_policy(self, policy, client=None):
             method='POST', path=path, data=resource)
         return Policy.from_api_repr(resp)
 
-    def test_iam_permissions(self, permissions, client=None):
-        """Permissions allowed for the current user by the effective IAM policy.
+    def check_iam_permissions(self, permissions, client=None):
+        """Verify permissions allowed for the current user.
 
         See:
         https://cloud.google.com/pubsub/reference/rest/v1/projects.topics/testIamPermissions


Test patch:
diff --git a/gcloud/pubsub/test_subscription.py b/gcloud/pubsub/test_subscription.py
--- a/gcloud/pubsub/test_subscription.py
+++ b/gcloud/pubsub/test_subscription.py
@@ -641,7 +641,7 @@ def test_set_iam_policy_w_alternate_client(self):
         self.assertEqual(req['path'], '/%s' % PATH)
         self.assertEqual(req['data'], {})
 
-    def test_test_iam_permissions_w_bound_client(self):
+    def test_check_iam_permissions_w_bound_client(self):
         PROJECT = 'PROJECT'
         TOPIC_NAME = 'topic_name'
         SUB_NAME = 'sub_name'
@@ -659,7 +659,7 @@ def test_test_iam_permissions_w_bound_client(self):
         topic = _Topic(TOPIC_NAME, client=CLIENT)
         subscription = self._makeOne(SUB_NAME, topic)
 
-        allowed = subscription.test_iam_permissions(ROLES)
+        allowed = subscription.check_iam_permissions(ROLES)
 
         self.assertEqual(allowed, ROLES[:-1])
         self.assertEqual(len(conn._requested), 1)
@@ -668,7 +668,7 @@ def test_test_iam_permissions_w_bound_client(self):
         self.assertEqual(req['path'], '/%s' % PATH)
         self.assertEqual(req['data'], REQUESTED)
 
-    def test_test_iam_permissions_w_alternate_client(self):
+    def test_check_iam_permissions_w_alternate_client(self):
         PROJECT = 'PROJECT'
         TOPIC_NAME = 'topic_name'
         SUB_NAME = 'sub_name'
@@ -686,7 +686,7 @@ def test_test_iam_permissions_w_alternate_client(self):
         topic = _Topic(TOPIC_NAME, client=CLIENT1)
         subscription = self._makeOne(SUB_NAME, topic)
 
-        allowed = subscription.test_iam_permissions(ROLES, client=CLIENT2)
+        allowed = subscription.check_iam_permissions(ROLES, client=CLIENT2)
 
         self.assertEqual(len(allowed), 0)
         self.assertEqual(len(conn1._requested), 0)
diff --git a/gcloud/pubsub/test_topic.py b/gcloud/pubsub/test_topic.py
--- a/gcloud/pubsub/test_topic.py
+++ b/gcloud/pubsub/test_topic.py
@@ -601,7 +601,7 @@ def test_set_iam_policy_w_alternate_client(self):
         self.assertEqual(req['path'], '/%s' % PATH)
         self.assertEqual(req['data'], {})
 
-    def test_test_iam_permissions_w_bound_client(self):
+    def test_check_iam_permissions_w_bound_client(self):
         from gcloud.pubsub.iam import OWNER_ROLE, WRITER_ROLE, READER_ROLE
         TOPIC_NAME = 'topic_name'
         PROJECT = 'PROJECT'
@@ -618,7 +618,7 @@ def test_test_iam_permissions_w_bound_client(self):
         CLIENT = _Client(project=PROJECT, connection=conn)
         topic = self._makeOne(TOPIC_NAME, client=CLIENT)
 
-        allowed = topic.test_iam_permissions(ROLES)
+        allowed = topic.check_iam_permissions(ROLES)
 
         self.assertEqual(allowed, ROLES[:-1])
         self.assertEqual(len(conn._requested), 1)
@@ -627,7 +627,7 @@ def test_test_iam_permissions_w_bound_client(self):
         self.assertEqual(req['path'], '/%s' % PATH)
         self.assertEqual(req['data'], REQUESTED)
 
-    def test_test_iam_permissions_w_alternate_client(self):
+    def test_check_iam_permissions_w_alternate_client(self):
         from gcloud.pubsub.iam import OWNER_ROLE, WRITER_ROLE, READER_ROLE
         TOPIC_NAME = 'topic_name'
         PROJECT = 'PROJECT'
@@ -644,7 +644,7 @@ def test_test_iam_permissions_w_alternate_client(self):
         CLIENT2 = _Client(project=PROJECT, connection=conn2)
         topic = self._makeOne(TOPIC_NAME, client=CLIENT1)
 
-        allowed = topic.test_iam_permissions(ROLES, client=CLIENT2)
+        allowed = topic.check_iam_permissions(ROLES, client=CLIENT2)
 
         self.assertEqual(len(allowed), 0)
         self.assertEqual(len(conn1._requested), 0)