diff options
author | yang-g <yangg@google.com> | 2016-07-08 17:05:02 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2016-07-08 17:05:02 -0700 |
commit | dc3a775e6026666f698e5460281645acb2005dd8 (patch) | |
tree | 510a4c7cf4e6b81dd8a2c5652d56f3006533c11d /src/python/grpcio_tests/tests/unit/test_common.py | |
parent | 9ef0cd81f74eff88191cff541add28765b59ff46 (diff) | |
parent | c1bfe124ab0d151f7619f4fefc08244bd1dd4750 (diff) |
Merge remote-tracking branch 'upstream/master' into import
Diffstat (limited to 'src/python/grpcio_tests/tests/unit/test_common.py')
-rw-r--r-- | src/python/grpcio_tests/tests/unit/test_common.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/python/grpcio_tests/tests/unit/test_common.py b/src/python/grpcio_tests/tests/unit/test_common.py index c8886bf4ca..cd71bd80d7 100644 --- a/src/python/grpcio_tests/tests/unit/test_common.py +++ b/src/python/grpcio_tests/tests/unit/test_common.py @@ -31,6 +31,7 @@ import collections +import grpc import six INVOCATION_INITIAL_METADATA = (('0', 'abc'), ('1', 'def'), ('2', 'ghi'),) @@ -78,3 +79,24 @@ def metadata_transmitted(original_metadata, transmitted_metadata): return False else: return True + + +def test_secure_channel( + target, channel_credentials, server_host_override): + """Creates an insecure Channel to a remote host. + + Args: + host: The name of the remote host to which to connect. + port: The port of the remote host to which to connect. + channel_credentials: The implementations.ChannelCredentials with which to + connect. + server_host_override: The target name used for SSL host name checking. + + Returns: + An implementations.Channel to the remote host through which RPCs may be + conducted. + """ + channel = grpc.secure_channel( + target, channel_credentials, + (('grpc.ssl_target_name_override', server_host_override,),)) + return channel |