Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename 'Topic.test_iam_permissions' -> 'check_iam_permissions.' #1652

Merged
merged 1 commit into from
Mar 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/pubsub-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions gcloud/pubsub/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions gcloud/pubsub/test_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
Expand All @@ -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'
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions gcloud/pubsub/test_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
Expand All @@ -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'
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions gcloud/pubsub/topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down