From ebdc103661bea35c4f97e35461e77c49a5da648e Mon Sep 17 00:00:00 2001 From: Austen Collins Date: Tue, 15 Sep 2015 19:06:38 -0700 Subject: [PATCH] logo: update --- lib/commands/deploy_endpoint.js | 19 +++++++++++-------- tests/cli/deploy_endpoint.js | 19 ++++++++++++------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/commands/deploy_endpoint.js b/lib/commands/deploy_endpoint.js index a65a8bf54..d97a88a56 100644 --- a/lib/commands/deploy_endpoint.js +++ b/lib/commands/deploy_endpoint.js @@ -80,7 +80,7 @@ CMD.prototype.run = Promise.method(function() { }) .each(function(regionJson) { - JawsCli.log('Endpoint Deployer: Deploying endpoint(s) to region "' + regionJson + '"...'); + JawsCli.log('Endpoint Deployer: Deploying endpoint(s) to region "' + regionJson.region + '"...'); var deployer = new ApiDeployer( _this._stage, @@ -95,7 +95,7 @@ CMD.prototype.run = Promise.method(function() { JawsCli.log('Endpoint Deployer: Endpoints for stage "' + _this._stage + '" successfully deployed to API Gateway in the region "' - + region + + regionJson.region + '". Access them @ ' + url); }); @@ -245,7 +245,7 @@ ApiDeployer.prototype._validateAndSantizeTaggedEndpoints = Promise.method(functi if (e.Path.charAt(0) === '/') e.Path = e.Path.substring(1); // Sanitize method - e.method = e.method.toUpperCase(); + e.Method = e.Method.toUpperCase(); } }); @@ -439,7 +439,7 @@ ApiDeployer.prototype._createEndpointMethod = Promise.method(function(endpoint) // Create Method var methodBody = { - authorizationType: endpoint.endpoint.authorizationType, + authorizationType: endpoint.apiGateway.cloudFormation.AuthorizationType, }; // If Request Params, add them @@ -516,7 +516,7 @@ ApiDeployer.prototype._createEndpointIntegration = Promise.method(function(endpo + ':function:' + [_this._stage, _this._prjJson.name, - endpoint.lambda.functionName, // TODO: Need to get this + utils.generateLambdaName(endpoint.lambda), ].join('_-_').replace(/ /g, '') + '/invocations', credentials: _this._regionJson.iamRoleArnApiGateway, @@ -726,12 +726,15 @@ ApiDeployer.prototype._createEndpointMethodIntegResponses = Promise.method(funct return Promise.try(function() { // Collect Response Keys - if (endpoint.apiGateway.cloudFormation.Responses) return Object.keys(endpoint.apiGateway.cloudFormation.responses); - else return []; + if (endpoint.apiGateway.cloudFormation.Responses) { + return Object.keys(endpoint.apiGateway.cloudFormation.Responses); + } else { + return []; + } }) .each(function(responseKey) { - var thisResponse = endpoint.apiGateway.cloudFormation.responses[responseKey]; + var thisResponse = endpoint.apiGateway.cloudFormation.Responses[responseKey]; var integrationResponseBody = {}; // Add Response Parameters diff --git a/tests/cli/deploy_endpoint.js b/tests/cli/deploy_endpoint.js index f3b5f3197..f4b875f9d 100644 --- a/tests/cli/deploy_endpoint.js +++ b/tests/cli/deploy_endpoint.js @@ -6,6 +6,7 @@ var Jaws = require('../../lib/index.js'), CmdDeployEndpoints = require('../../lib/commands/deploy_endpoint'), + CmdTag = require('../../lib/commands/tag'), JawsError = require('../../lib/jaws-error'), testUtils = require('../test_utils'), Promise = require('bluebird'), @@ -31,10 +32,14 @@ describe('Test deploy endpoint command', function() { JAWS = new Jaws(); // Get Lambda Paths - lambdaPaths.lambda1 = path.join(projPath, 'back', 'lambdas', 'sessions', 'show', 'jaws.json'); - lambdaPaths.lambda2 = path.join(projPath, 'back', 'lambdas', 'sessions', 'create', 'jaws.json'); - lambdaPaths.lambda3 = path.join(projPath, 'back', 'lambdas', 'users', 'create', 'jaws.json'); - }).then(done); + lambdaPaths.lambda1 = path.join(projPath, 'back', 'lambdas', 'sessions', 'show', 'awsm.json'); + lambdaPaths.lambda2 = path.join(projPath, 'back', 'lambdas', 'sessions', 'create', 'awsm.json'); + lambdaPaths.lambda3 = path.join(projPath, 'back', 'lambdas', 'users', 'create', 'awsm.json'); + + }) + .then(function() { + CmdTag.tagAll(JAWS, 'endpoint', false); + }).then(done); }); describe('Positive tests', function() { @@ -56,9 +61,9 @@ describe('Test deploy endpoint command', function() { }); it('Check jaws.json files were untagged', function(done) { - assert.equal(false, require(lambdaPaths.lambda1).endpoint.deploy); - assert.equal(false, require(lambdaPaths.lambda2).endpoint.deploy); - assert.equal(false, require(lambdaPaths.lambda3).endpoint.deploy); + assert.equal(false, require(lambdaPaths.lambda1).apiGateway.deploy); + assert.equal(false, require(lambdaPaths.lambda2).apiGateway.deploy); + assert.equal(false, require(lambdaPaths.lambda3).apiGateway.deploy); done(); });