aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/tests/interop/methods.py
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-06-09 07:50:50 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-06-09 07:50:50 -0700
commit0ca68b7cb19d2735f965d283b9974d8cd42df51d (patch)
tree10abff4f54d5c109e8aa813a340729ba1ef2689f /src/python/grpcio/tests/interop/methods.py
parent16ebf5a124026f8e9d59894b214d2e743590a93e (diff)
parent1bc2976a0f51e14d3525aecbf4b3450445ed2d1b (diff)
Merge github.com:grpc/grpc into error
Diffstat (limited to 'src/python/grpcio/tests/interop/methods.py')
-rw-r--r--src/python/grpcio/tests/interop/methods.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/python/grpcio/tests/interop/methods.py b/src/python/grpcio/tests/interop/methods.py
index d5ef0c68bb..7eac511525 100644
--- a/src/python/grpcio/tests/interop/methods.py
+++ b/src/python/grpcio/tests/interop/methods.py
@@ -310,6 +310,16 @@ def _oauth2_auth_token(stub, args):
(response.oauth_scope, args.oauth_scope))
+def _jwt_token_creds(stub, args):
+ json_key_filename = os.environ[
+ oauth2client_client.GOOGLE_APPLICATION_CREDENTIALS]
+ wanted_email = json.load(open(json_key_filename, 'rb'))['client_email']
+ response = _large_unary_common_behavior(stub, True, False)
+ if wanted_email != response.username:
+ raise ValueError(
+ 'expected username %s, got %s' % (wanted_email, response.username))
+
+
def _per_rpc_creds(stub, args):
json_key_filename = os.environ[
oauth2client_client.GOOGLE_APPLICATION_CREDENTIALS]
@@ -338,6 +348,7 @@ class TestCase(enum.Enum):
EMPTY_STREAM = 'empty_stream'
COMPUTE_ENGINE_CREDS = 'compute_engine_creds'
OAUTH2_AUTH_TOKEN = 'oauth2_auth_token'
+ JWT_TOKEN_CREDS = 'jwt_token_creds'
PER_RPC_CREDS = 'per_rpc_creds'
TIMEOUT_ON_SLEEPING_SERVER = 'timeout_on_sleeping_server'
@@ -364,6 +375,8 @@ class TestCase(enum.Enum):
_compute_engine_creds(stub, args)
elif self is TestCase.OAUTH2_AUTH_TOKEN:
_oauth2_auth_token(stub, args)
+ elif self is TestCase.JWT_TOKEN_CREDS:
+ _jwt_token_creds(stub, args)
elif self is TestCase.PER_RPC_CREDS:
_per_rpc_creds(stub, args)
else: