diff --git a/lib/cartodb/backends/template_maps.js b/lib/cartodb/backends/template_maps.js index c30b964c..e415dec6 100644 --- a/lib/cartodb/backends/template_maps.js +++ b/lib/cartodb/backends/template_maps.js @@ -21,7 +21,7 @@ var util = require('util'); // @param opts TemplateMap options. Supported elements: // 'max_user_templates' limit on the number of per-user // -// +// function TemplateMaps(redis_pool, opts) { if (!(this instanceof TemplateMaps)) { return new TemplateMaps(); @@ -41,7 +41,7 @@ function TemplateMaps(redis_pool, opts) { // // Map templates are owned by a user that specifies access permissions // for their instances. - // + // // We have the following datastores: // // 1. User templates: set of per-user map templates @@ -197,7 +197,7 @@ function templateDefaults(template) { // @param template layergroup template, see // http://github.com/CartoDB/Windshaft-cartodb/wiki/Template-maps#template-format // -// @param callback function(err, tpl_id) +// @param callback function(err, tpl_id) // Return template identifier (only valid for given user) // o.addTemplate = function(owner, template, callback) { @@ -296,7 +296,7 @@ o.delTemplate = function(owner, tpl_id, callback) { // http://github.com/CartoDB/Windshaft-cartodb/wiki/Template-maps#template-format // // @param callback function(err) -// +// o.updTemplate = function(owner, tpl_id, template, callback) { var self = this; @@ -355,7 +355,7 @@ o.updTemplate = function(owner, tpl_id, template, callback) { // // @param callback function(err, tpl_id_list) // Returns a list of template identifiers -// +// o.listTemplates = function(owner, callback) { this._redisCmd('HKEYS', [ this.key_usr_tpl({owner:owner}) ], callback); }; @@ -422,7 +422,7 @@ o.isAuthorized = function(template, authTokens) { // Only the ones found in the template's placeholders object // will be used, with missing ones taking default values. // -// @returns a layergroup configuration +// @returns a layergroup configuration // // @throws Error on malformed template or parameter // @@ -431,7 +431,7 @@ var _reNumber = /^([-+]?[\d\.]?\d+([eE][+-]?\d+)?)$/, _reCSSColorVal = /^#[0-9a-fA-F]{3,6}$/; function _replaceVars (str, params) { - //return _.template(str, params); // lazy way, possibly dangerous + //return _.template(str, params); // lazy way, possibly dangerous // Construct regular expressions for each param Object.keys(params).forEach(function(k) { str = str.replace(new RegExp("<%=\\s*" + k + "\\s*%>", "g"), params[k]); diff --git a/test/acceptance/health_check.js b/test/acceptance/health_check.js index 8cfa0e0d..576a6e6f 100644 --- a/test/acceptance/health_check.js +++ b/test/acceptance/health_check.js @@ -111,6 +111,6 @@ describe('health checks', function () { done(); }); - }); + }); }); diff --git a/test/acceptance/multilayer.js b/test/acceptance/multilayer.js index 76235303..94df8bdc 100644 --- a/test/acceptance/multilayer.js +++ b/test/acceptance/multilayer.js @@ -52,14 +52,14 @@ describe(suiteName, function() { { options: { sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, 5e6, 0) as the_geom_webmercator' + ' from test_table limit 2', - cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', cartocss_version: '2.0.1', interactivity: 'cartodb_id' } }, { options: { sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, -5e6, 0) as the_geom_webmercator' + ' from test_table limit 2 offset 2', - cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', cartocss_version: '2.0.2', interactivity: 'cartodb_id' } } @@ -104,7 +104,7 @@ describe(suiteName, function() { // Check X-Cache-Channel cc = res.headers['x-cache-channel']; - assert.ok(cc); + assert.ok(cc); var dbname = test_database; assert.equal(cc.substring(0, dbname.length), dbname); if (!cdbQueryTablesFromPostgresEnabledValue) { // only test if it was using the SQL API @@ -198,7 +198,7 @@ describe(suiteName, function() { { options: { sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, 5e6, 0) as the_geom_webmercator' + ' from test_table limit 2', - cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', cartocss_version: '2.0.1' } } ] @@ -211,7 +211,7 @@ describe(suiteName, function() { assert.response(server, { url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)), method: 'GET', - headers: {host: 'localhost'} + headers: {host: 'localhost'} }, {}, function(res, err) { next(err, res); }); }, function do_check_create(err, res) { @@ -245,7 +245,7 @@ describe(suiteName, function() { ] }; - var expected_token; + var expected_token; step( function do_create_get() { @@ -253,7 +253,7 @@ describe(suiteName, function() { assert.response(server, { url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)), method: 'GET', - headers: {host: 'localhost'} + headers: {host: 'localhost'} }, {}, function(res, err) { next(err, res); }); }, function do_check_create(err, res) { @@ -329,7 +329,7 @@ describe(suiteName, function() { { options: { sql: 'select 1 as cartodb_id, ST_Buffer(!bbox!, -32*greatest(!pixel_width!,!pixel_height!))' + ' as the_geom_webmercator from test_table limit 1', - cartocss: '#layer { polygon-fill:red; }', + cartocss: '#layer { polygon-fill:red; }', cartocss_version: '2.0.1', interactivity: 'cartodb_id' } } @@ -413,7 +413,7 @@ describe(suiteName, function() { // Check X-Cache-Channel var cc = res.headers['x-cache-channel']; - assert.ok(cc); + assert.ok(cc); var dbname = test_database; assert.equal(cc.substring(0, dbname.length), dbname); if (!cdbQueryTablesFromPostgresEnabledValue) { // only test if it was using the SQL API @@ -485,8 +485,8 @@ describe(suiteName, function() { { options: { sql: 'select 1 as cartodb_id, !pixel_height! as h,' + ' ST_Buffer(!bbox!, -32*greatest(!pixel_width!,!pixel_height!)) as the_geom_webmercator', - cartocss: '#layer { polygon-fill:red; }', - cartocss_version: '2.0.1' + cartocss: '#layer { polygon-fill:red; }', + cartocss_version: '2.0.1' } } ] }; @@ -578,8 +578,8 @@ describe(suiteName, function() { { options: { sql: 'select 1 as cartodb_id, !pixel_height! as h' + 'ST_Buffer(!bbox!, -32*greatest(!pixel_width!,!pixel_height!)) as the_geom_webmercator', - cartocss: '#layer { polygon-fit:red; }', - cartocss_version: '2.0.1' + cartocss: '#layer { polygon-fit:red; }', + cartocss_version: '2.0.1' } } ] }; @@ -606,8 +606,8 @@ describe(suiteName, function() { layers: [ { options: { sql: 'select bogus(0,0) as the_geom_webmercator', - cartocss: '#layer { polygon-fill:red; }', - cartocss_version: '2.0.1' + cartocss: '#layer { polygon-fill:red; }', + cartocss_version: '2.0.1' } } ] }; @@ -633,13 +633,13 @@ describe(suiteName, function() { layers: [ { options: { sql: 'select * from test_table_private_1 where cartodb_id=1', - cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', cartocss_version: '2.1.0', interactivity: 'cartodb_id' } }, { options: { sql: 'select * from test_table_private_1 where cartodb_id=2', - cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', cartocss_version: '2.1.0', interactivity: 'cartodb_id' } } @@ -684,7 +684,7 @@ describe(suiteName, function() { // Check X-Cache-Channel var cc = res.headers['x-cache-channel']; - assert.ok(cc); + assert.ok(cc); var dbname = test_database; assert.equal(cc.substring(0, dbname.length), dbname); next(err); @@ -780,7 +780,7 @@ describe(suiteName, function() { layers: [ { options: { sql: 'select * from test_table where cartodb_id=1', - cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', cartocss_version: '2.1.0', interactivity: 'cartodb_id' } } @@ -830,7 +830,7 @@ describe(suiteName, function() { // Check X-Cache-Channel var cc = res.headers['x-cache-channel']; - assert.ok(cc, "Missing X-Cache-Channel"); + assert.ok(cc, "Missing X-Cache-Channel"); var dbname = test_database; assert.equal(cc.substring(0, dbname.length), dbname); return null; @@ -965,7 +965,7 @@ describe(suiteName, function() { layers: [ { options: { sql: "select 'SRID=3857;POINT(0 0)'::geometry as the_geom_webmercator", - cartocss: '#layer { point-transform:"scale(20)"; }', + cartocss: '#layer { point-transform:"scale(20)"; }', cartocss_version: '2.0.1' } } ] @@ -1031,7 +1031,7 @@ describe(suiteName, function() { layers: [ { options: { sql: "select * from test_table_private_1 LIMIT 0", - cartocss: '#layer { marker-fill:red; }', + cartocss: '#layer { marker-fill:red; }', cartocss_version: '2.0.1' } } ] @@ -1105,7 +1105,7 @@ describe(suiteName, function() { layers: [ { options: { sql: sql, - cartocss: '#layer { marker-fill:red; }', + cartocss: '#layer { marker-fill:red; }', cartocss_version: '2.0.1' } } ] @@ -1194,7 +1194,7 @@ describe(suiteName, function() { layers: [ { options: { sql: "select *, 'SQLAPINOANSWER' from test_table", - cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', cartocss_version: '2.1.0' } } ] @@ -1318,7 +1318,7 @@ describe(suiteName, function() { } ); }); - + }); }); diff --git a/test/acceptance/ported/torque.js b/test/acceptance/ported/torque.js index 2784a825..84846ae1 100644 --- a/test/acceptance/ported/torque.js +++ b/test/acceptance/ported/torque.js @@ -418,7 +418,7 @@ describe('torque', function() { assert.response(server, { url: '/database/windshaft_test/layergroup', method: 'POST', - headers: {'Content-Type': 'application/json' }, + headers: {'Content-Type': 'application/json' }, data: JSON.stringify(layergroup) }, {}, function(res) { next(null, res); }); }, diff --git a/test/acceptance/templates.js b/test/acceptance/templates.js index 54fa70d8..d4eb304b 100644 --- a/test/acceptance/templates.js +++ b/test/acceptance/templates.js @@ -65,7 +65,7 @@ describe('template_api', function() { { options: { sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, -5e6, 0) as the_geom_webmercator' + ' from test_table limit 2 offset 2', - cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', cartocss_version: '2.0.2', interactivity: 'cartodb_id' } } @@ -326,8 +326,8 @@ describe('template_api', function() { headers: {host: 'localhost', 'Content-Type': 'application/json' }, data: JSON.stringify(tmpl) }; - assert.response(server, post_request, {}, function(res) { - next(null, res); + assert.response(server, post_request, {}, function(res) { + next(null, res); }); }, function testCORS() { @@ -338,12 +338,12 @@ describe('template_api', function() { headers: {host: 'localhost', 'Content-Type': 'application/json' } },{ status: 200 - }, function(res) { + }, function(res) { var parsed = JSON.parse(res.body); keysToDelete['map_cfg|' + LayergroupToken.parse(parsed.layergroupid).token] = 0; keysToDelete['user:localhost:mapviews:global'] = 5; assert.ok(_.isEqual(parsed.cdn_url, global.environment.serverMetadata.cdn_url)); - next(null); + next(null); }); }, function deleteTemplate(err) { @@ -720,7 +720,7 @@ describe('template_api', function() { layers: [ { options: { sql: "select * from test_table_private_1 LIMIT 0", - cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', cartocss_version: '2.0.2', interactivity: 'cartodb_id' } } @@ -848,7 +848,7 @@ describe('template_api', function() { }, function checkTile(err, res) { assert.ifError(err); - assert.equal(res.statusCode, 200, + assert.equal(res.statusCode, 200, 'Unexpected error for authorized instance: ' + res.statusCode + ' -- ' + res.body); assert.equal(res.headers['content-type'], "image/png"); return null; @@ -869,7 +869,7 @@ describe('template_api', function() { }, function checkForeignSignerError(err, res) { assert.ifError(err); - assert.equal(res.statusCode, 403, + assert.equal(res.statusCode, 403, 'Unexpected error for authorized instance: ' + res.statusCode + ' -- ' + res.body); var parsed = JSON.parse(res.body); assert.ok(parsed.hasOwnProperty('errors'), @@ -1036,7 +1036,7 @@ describe('template_api', function() { }, function checkTile_fetchOnRestart(err, res) { assert.ifError(err); - assert.equal(res.statusCode, 200, + assert.equal(res.statusCode, 200, 'Unexpected error for authorized instance: ' + res.statusCode + ' -- ' + res.body); assert.equal(res.headers['content-type'], "application/json; charset=utf-8"); var cc = res.headers['x-cache-channel']; @@ -1056,7 +1056,7 @@ describe('template_api', function() { }, function checkCacheChannel(err, res) { assert.ifError(err); - assert.equal(res.statusCode, 200, + assert.equal(res.statusCode, 200, 'Unexpected error for authorized instance: ' + res.statusCode + ' -- ' + res.body); assert.equal(res.headers['content-type'], "application/json; charset=utf-8"); var cc = res.headers['x-cache-channel']; @@ -1112,7 +1112,7 @@ describe('template_api', function() { layers: [ { options: { sql: "select * from test_table_private_1 where cartodb_id in ( 5,6 )", - cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', cartocss_version: '2.0.2', attributes: { id:'cartodb_id', columns: ['name', 'address'] } } } @@ -1224,7 +1224,7 @@ describe('template_api', function() { }, function checkAttribute(err, res) { assert.ifError(err); - assert.equal(res.statusCode, 200, + assert.equal(res.statusCode, 200, 'Unexpected error for authorized getAttributes: ' + res.statusCode + ' -- ' + res.body); assert.equal(res.headers['content-type'], "application/json; charset=utf-8"); return null; @@ -1277,7 +1277,7 @@ describe('template_api', function() { layers: [ { options: { sql: "select * from test_table_private_1 LIMIT 0", - cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', cartocss_version: '2.0.2', interactivity: 'cartodb_id' } } @@ -1347,7 +1347,7 @@ describe('template_api', function() { layers: [ { options: { sql: "select * from test_table_private_1 LIMIT 0", - cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', cartocss_version: '2.0.2', interactivity: 'cartodb_id' } } @@ -1430,7 +1430,7 @@ describe('template_api', function() { layers: [ { options: { sql: "select * from test_table_private_1 LIMIT 0", - cartocss: '#layer { marker-fill: <%= color %>; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill: <%= color %>; marker-allow-overlap:true; }', cartocss_version: '2.0.2', interactivity: 'cartodb_id' } } @@ -1503,8 +1503,8 @@ describe('template_api', function() { { options: { sql: 'select 1 as cartodb_id, !pixel_height! as h,' + ' ST_Buffer(!bbox!, -32*greatest(!pixel_width!,!pixel_height!)) as the_geom_webmercator', - cartocss: '#layer { polygon-fill:red; }', - cartocss_version: '2.0.1' + cartocss: '#layer { polygon-fill:red; }', + cartocss_version: '2.0.1' } } ] }; @@ -1516,7 +1516,7 @@ describe('template_api', function() { }; var statskey = "user:localhost:mapviews"; var redis_stats_client = redis.createClient(global.environment.redis.port); - var template_id; // will be set on template post + var template_id; // will be set on template post var now = strftime("%Y%m%d", new Date()); var errors = []; step( @@ -1621,7 +1621,7 @@ describe('template_api', function() { layers: [ { options: { sql: "select * from test_table_private_1 LIMIT 0", - cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', + cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', cartocss_version: '2.0.2', interactivity: 'cartodb_id' } } diff --git a/test/support/config.js b/test/support/config.js index d1dcf6e9..4b8102f7 100644 --- a/test/support/config.js +++ b/test/support/config.js @@ -7,8 +7,8 @@ module.exports = function(opts) { var config = { redis_pool: { - max: 10, - idleTimeoutMillis: 1, + max: 10, + idleTimeoutMillis: 1, reapIntervalMillis: 1, port: global.environment.redis.port } diff --git a/test/support/prepare_db.sh b/test/support/prepare_db.sh index ab9149a2..4f001228 100755 --- a/test/support/prepare_db.sh +++ b/test/support/prepare_db.sh @@ -72,10 +72,10 @@ if test x"$PREPARE_PGSQL" = xyes; then createdb -Ttemplate_postgis -EUTF8 "${TEST_DB}" || die "Could not create test database" cat sql/windshaft.test.sql sql/gadm4.sql | - sed "s/:PUBLICUSER/${PUBLICUSER}/" | - sed "s/:PUBLICPASS/${PUBLICPASS}/" | - sed "s/:TESTUSER/${TESTUSER}/" | - sed "s/:TESTPASS/${TESTPASS}/" | + sed "s/:PUBLICUSER/${PUBLICUSER}/" | + sed "s/:PUBLICPASS/${PUBLICPASS}/" | + sed "s/:TESTUSER/${TESTUSER}/" | + sed "s/:TESTPASS/${TESTPASS}/" | psql -v ON_ERROR_STOP=1 ${TEST_DB} || exit 1 psql -c "CREATE LANGUAGE plpythonu;" ${TEST_DB} @@ -98,7 +98,7 @@ HMSET rails:users:localhost id ${TESTUSERID} \ SADD rails:users:localhost:map_key 1235 EOF - # A user configured as with cartodb-2.5.0+ + # A user configured as with cartodb-2.5.0+ cat <