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

Make secure_authorized_channel pass kwargs to grpc.secure_channel #90

Merged
merged 1 commit into from
Dec 2, 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
5 changes: 3 additions & 2 deletions google/auth/transport/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __call__(self, context, callback):


def secure_authorized_channel(
credentials, request, target, ssl_credentials=None):
credentials, request, target, ssl_credentials=None, **kwargs):
"""Creates a secure authorized gRPC channel.

This creates a channel with SSL and :class:`AuthMetadataPlugin`. This
Expand Down Expand Up @@ -98,6 +98,7 @@ def secure_authorized_channel(
target (str): The host and port of the service.
ssl_credentials (grpc.ChannelCredentials): Optional SSL channel
credentials. This can be used to specify different certificates.
kwargs: Additional arguments to pass to :func:`grpc.secure_channel`.

Returns:
grpc.Channel: The created gRPC channel.
Expand All @@ -115,4 +116,4 @@ def secure_authorized_channel(
composite_credentials = grpc.composite_channel_credentials(
ssl_credentials, google_auth_credentials)

return grpc.secure_channel(target, composite_credentials)
return grpc.secure_channel(target, composite_credentials, **kwargs)
5 changes: 3 additions & 2 deletions tests/transport/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_secure_authorized_channel(
target = 'example.com:80'

channel = google.auth.transport.grpc.secure_authorized_channel(
credentials, request, target)
credentials, request, target, options=mock.sentinel.options)

# Check the auth plugin construction.
auth_plugin = metadata_call_credentials.call_args[0][0]
Expand All @@ -101,7 +101,8 @@ def test_secure_authorized_channel(

# Check the channel call.
secure_channel.assert_called_once_with(
target, composite_channel_credentials.return_value)
target, composite_channel_credentials.return_value,
options=mock.sentinel.options)
assert channel == secure_channel.return_value


Expand Down