|
|
|
@ -376,7 +376,7 @@ def _unimplemented_service(unimplemented_service_stub): |
|
|
|
|
|
|
|
|
|
def _custom_metadata(stub): |
|
|
|
|
initial_metadata_value = "test_initial_metadata_value" |
|
|
|
|
trailing_metadata_value = "\x0a\x0b\x0a\x0b\x0a\x0b" |
|
|
|
|
trailing_metadata_value = b"\x0a\x0b\x0a\x0b\x0a\x0b" |
|
|
|
|
metadata = ((_INITIAL_METADATA_KEY, initial_metadata_value), |
|
|
|
|
(_TRAILING_METADATA_KEY, trailing_metadata_value)) |
|
|
|
|
|
|
|
|
@ -390,7 +390,7 @@ def _custom_metadata(stub): |
|
|
|
|
if trailing_metadata[_TRAILING_METADATA_KEY] != trailing_metadata_value: |
|
|
|
|
raise ValueError('expected trailing metadata %s, got %s' % |
|
|
|
|
(trailing_metadata_value, |
|
|
|
|
initial_metadata[_TRAILING_METADATA_KEY])) |
|
|
|
|
trailing_metadata[_TRAILING_METADATA_KEY])) |
|
|
|
|
|
|
|
|
|
# Testing with UnaryCall |
|
|
|
|
request = messages_pb2.SimpleRequest( |
|
|
|
@ -421,7 +421,7 @@ def _compute_engine_creds(stub, args): |
|
|
|
|
|
|
|
|
|
def _oauth2_auth_token(stub, args): |
|
|
|
|
json_key_filename = os.environ[google_auth_environment_vars.CREDENTIALS] |
|
|
|
|
wanted_email = json.load(open(json_key_filename, 'rb'))['client_email'] |
|
|
|
|
wanted_email = json.load(open(json_key_filename, 'r'))['client_email'] |
|
|
|
|
response = _large_unary_common_behavior(stub, True, True, None) |
|
|
|
|
if wanted_email != response.username: |
|
|
|
|
raise ValueError('expected username %s, got %s' % (wanted_email, |
|
|
|
@ -434,7 +434,7 @@ def _oauth2_auth_token(stub, args): |
|
|
|
|
|
|
|
|
|
def _jwt_token_creds(stub, args): |
|
|
|
|
json_key_filename = os.environ[google_auth_environment_vars.CREDENTIALS] |
|
|
|
|
wanted_email = json.load(open(json_key_filename, 'rb'))['client_email'] |
|
|
|
|
wanted_email = json.load(open(json_key_filename, 'r'))['client_email'] |
|
|
|
|
response = _large_unary_common_behavior(stub, True, False, None) |
|
|
|
|
if wanted_email != response.username: |
|
|
|
|
raise ValueError('expected username %s, got %s' % (wanted_email, |
|
|
|
@ -443,7 +443,7 @@ def _jwt_token_creds(stub, args): |
|
|
|
|
|
|
|
|
|
def _per_rpc_creds(stub, args): |
|
|
|
|
json_key_filename = os.environ[google_auth_environment_vars.CREDENTIALS] |
|
|
|
|
wanted_email = json.load(open(json_key_filename, 'rb'))['client_email'] |
|
|
|
|
wanted_email = json.load(open(json_key_filename, 'r'))['client_email'] |
|
|
|
|
google_credentials, unused_project_id = google_auth.default( |
|
|
|
|
scopes=[args.oauth_scope]) |
|
|
|
|
call_credentials = grpc.metadata_call_credentials( |
|
|
|
|