diff options
author | Tim Emiola <tbetbetbe@users.noreply.github.com> | 2015-03-20 16:16:14 -0700 |
---|---|---|
committer | Tim Emiola <tbetbetbe@users.noreply.github.com> | 2015-03-20 16:16:14 -0700 |
commit | c67aaea2207e63fe41c424c1585496f3e5897b87 (patch) | |
tree | b8754c382ef76328db9faa4fb310048ec2f6acc4 | |
parent | 3bd5fa6c78fb3b0dc389038e765d399e54e740b5 (diff) | |
parent | 90da75ed2d0b037500d92150f3ac8c238fb0b673 (diff) |
Merge pull request #1105 from murgatroid99/node_compute_engine_creds_test_fix
Fix Node Compute Engine Auth test
-rw-r--r-- | src/node/interop/interop_client.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 8060baf827..77804cf595 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -35,6 +35,7 @@ var fs = require('fs'); var path = require('path'); +var _ = require('underscore'); var grpc = require('..'); var testProto = grpc.load(__dirname + '/test.proto').grpc.testing; var GoogleAuth = require('google-auth-library'); @@ -45,6 +46,8 @@ var AUTH_SCOPE = 'https://www.googleapis.com/auth/xapi.zoo'; var AUTH_SCOPE_RESPONSE = 'xapi.zoo'; var AUTH_USER = ('155450119199-3psnrh1sdr3d8cpj1v46naggf81mhdnk' + '@developer.gserviceaccount.com'); +var COMPUTE_ENGINE_USER = ('155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel' + + '@developer.gserviceaccount.com'); /** * Create a buffer filled with size zeroes @@ -265,11 +268,12 @@ function cancelAfterFirstResponse(client, done) { /** * Run one of the authentication tests. + * @param {string} expected_user The expected username in the response * @param {Client} client The client to test against * @param {function} done Callback to call when the test is completed. Included * primarily for use with mocha */ -function authTest(client, done) { +function authTest(expected_user, client, done) { (new GoogleAuth()).getApplicationDefault(function(err, credential) { assert.ifError(err); if (credential.createScopedRequired()) { @@ -290,7 +294,7 @@ function authTest(client, done) { assert.strictEqual(resp.payload.type, testProto.PayloadType.COMPRESSABLE); assert.strictEqual(resp.payload.body.limit - resp.payload.body.offset, 314159); - assert.strictEqual(resp.username, AUTH_USER); + assert.strictEqual(resp.username, expected_user); assert.strictEqual(resp.oauth_scope, AUTH_SCOPE_RESPONSE); }); call.on('status', function(status) { @@ -314,8 +318,8 @@ var test_cases = { empty_stream: emptyStream, cancel_after_begin: cancelAfterBegin, cancel_after_first_response: cancelAfterFirstResponse, - compute_engine_creds: authTest, - service_account_creds: authTest + compute_engine_creds: _.partial(authTest, AUTH_USER), + service_account_creds: _.partial(authTest, COMPUTE_ENGINE_USER) }; /** |