Skip to content
Snippets Groups Projects
Commit 2f9f29a4 authored by Tim Emiola's avatar Tim Emiola
Browse files

Merge pull request #1549 from murgatroid99/node_jwtaccess_interop_test

Added jwtaccess cloud-to-prod interop test
parents 06578a15 1b40198f
No related branches found
No related tags found
No related merge requests found
...@@ -267,14 +267,15 @@ function cancelAfterFirstResponse(client, done) { ...@@ -267,14 +267,15 @@ function cancelAfterFirstResponse(client, done) {
* Run one of the authentication tests. * Run one of the authentication tests.
* @param {string} expected_user The expected username in the response * @param {string} expected_user The expected username in the response
* @param {Client} client The client to test against * @param {Client} client The client to test against
* @param {?string} scope The scope to apply to the credentials
* @param {function} done Callback to call when the test is completed. Included * @param {function} done Callback to call when the test is completed. Included
* primarily for use with mocha * primarily for use with mocha
*/ */
function authTest(expected_user, client, done) { function authTest(expected_user, client, scope, done) {
(new GoogleAuth()).getApplicationDefault(function(err, credential) { (new GoogleAuth()).getApplicationDefault(function(err, credential) {
assert.ifError(err); assert.ifError(err);
if (credential.createScopedRequired()) { if (credential.createScopedRequired() && scope) {
credential = credential.createScoped(AUTH_SCOPE); credential = credential.createScoped(scope);
} }
client.updateMetadata = grpc.getGoogleAuthDelegate(credential); client.updateMetadata = grpc.getGoogleAuthDelegate(credential);
var arg = { var arg = {
...@@ -314,8 +315,9 @@ var test_cases = { ...@@ -314,8 +315,9 @@ var test_cases = {
empty_stream: emptyStream, empty_stream: emptyStream,
cancel_after_begin: cancelAfterBegin, cancel_after_begin: cancelAfterBegin,
cancel_after_first_response: cancelAfterFirstResponse, cancel_after_first_response: cancelAfterFirstResponse,
compute_engine_creds: _.partial(authTest, COMPUTE_ENGINE_USER), compute_engine_creds: _.partial(authTest, COMPUTE_ENGINE_USER, null),
service_account_creds: _.partial(authTest, AUTH_USER) service_account_creds: _.partial(authTest, AUTH_USER, AUTH_SCOPE),
jwt_token_creds: _.partial(authTest, AUTH_USER, null)
}; };
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment