Skip to content
Snippets Groups Projects
Commit 3b6fef12 authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

fix some python auth interop tests

parent e2a1bf46
No related branches found
No related tags found
No related merge requests found
...@@ -71,12 +71,17 @@ def _oauth_access_token(args): ...@@ -71,12 +71,17 @@ def _oauth_access_token(args):
def _stub(args): def _stub(args):
if args.oauth_scope: if args.oauth_scope:
if args.test_case == 'oauth2_auth_token': if args.test_case == 'oauth2_auth_token':
# TODO(jtattermusch): This testcase sets the auth metadata key-value
# manually, which also means that the user would need to do the same
# thing every time he/she would like to use and out of band oauth token.
# The transformer function that produces the metadata key-value from
# the access token should be provided by gRPC auth library.
access_token = _oauth_access_token(args) access_token = _oauth_access_token(args)
metadata_transformer = lambda x: [ metadata_transformer = lambda x: [
('Authorization', 'Bearer %s' % access_token)] ('authorization', 'Bearer %s' % access_token)]
else: else:
metadata_transformer = lambda x: [ metadata_transformer = lambda x: [
('Authorization', 'Bearer %s' % _oauth_access_token(args))] ('authorization', 'Bearer %s' % _oauth_access_token(args))]
else: else:
metadata_transformer = lambda x: [] metadata_transformer = lambda x: []
if args.use_tls: if args.use_tls:
......
...@@ -350,7 +350,7 @@ def add_auth_options(language, test_case, cmdline, env): ...@@ -350,7 +350,7 @@ def add_auth_options(language, test_case, cmdline, env):
default_account_arg = '--default_service_account=830293263384-compute@developer.gserviceaccount.com' default_account_arg = '--default_service_account=830293263384-compute@developer.gserviceaccount.com'
if test_case in ['jwt_token_creds', 'per_rpc_creds', 'oauth2_auth_token']: if test_case in ['jwt_token_creds', 'per_rpc_creds', 'oauth2_auth_token']:
if language in ['csharp', 'node', 'php', 'ruby']: if language in ['csharp', 'node', 'php', 'python', 'ruby']:
env['GOOGLE_APPLICATION_CREDENTIALS'] = key_filepath env['GOOGLE_APPLICATION_CREDENTIALS'] = key_filepath
else: else:
cmdline += [key_file_arg] cmdline += [key_file_arg]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment