From bb94726647cd4a45ae835688ef5e556ea748170b Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Wed, 23 Mar 2016 12:05:08 -0400 Subject: [PATCH] Rename 'Topic.test_iam_permissions' -> 'check_iam_permissions.' Closes #1648. --- docs/pubsub-usage.rst | 4 ++-- gcloud/pubsub/subscription.py | 4 ++-- gcloud/pubsub/test_subscription.py | 8 ++++---- gcloud/pubsub/test_topic.py | 8 ++++---- gcloud/pubsub/topic.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/pubsub-usage.rst b/docs/pubsub-usage.rst index 075dcc611b18..df58f7273ae6 100644 --- a/docs/pubsub-usage.rst +++ b/docs/pubsub-usage.rst @@ -102,7 +102,7 @@ Test permissions allowed by the current IAM policy on a topic: >>> from gcloud.pubsub.iam import OWNER_ROLE, WRITER_ROLE, READER_ROLE >>> client = pubsub.Client() >>> topic = client.topic('topic_name') - >>> allowed = topic.test_iam_permissions( + >>> allowed = topic.check_iam_permissions( ... [READER_ROLE, WRITER_ROLE, OWNER_ROLE]) # API request >>> allowed == [READER_ROLE, WRITER_ROLE] True @@ -353,7 +353,7 @@ Test permissions allowed by the current IAM policy on a subscription: >>> client = pubsub.Client() >>> topic = client.topic('topic_name') >>> subscription = topic.subscription('subscription_name') - >>> allowed = subscription.test_iam_permissions( + >>> allowed = subscription.check_iam_permissions( ... [READER_ROLE, WRITER_ROLE, OWNER_ROLE]) # API request >>> allowed == [READER_ROLE, WRITER_ROLE] True diff --git a/gcloud/pubsub/subscription.py b/gcloud/pubsub/subscription.py index 14d8c8019e8a..b9e5ef30834b 100644 --- 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/test_subscription.py b/gcloud/pubsub/test_subscription.py index 0165814b0e13..d4d3b2746e89 100644 --- 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 index 74f00674662d..de52cddc1c7f 100644 --- 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) diff --git a/gcloud/pubsub/topic.py b/gcloud/pubsub/topic.py index 9f1834bbd43f..859a84c93d29 100644 --- 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