Deprecates old config URLs: /tiles/template and /tiles/layergroup

Moves all tests to run on new URLs
Deprecated base_url_legacy in config, it will keep working tho
This commit is contained in:
Raul Ochoa 2015-03-23 15:54:45 +01:00
parent 23f5be6c33
commit d9ab1e8810
8 changed files with 94 additions and 100 deletions

View File

@ -14,13 +14,11 @@ var config = {
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/tiles/template|/u/:user/api/v1/map/named|/u/:user/tiles/template)'
,base_url_templated: '(?:/api/v1/map/named|/u/:user/api/v1/map/named)'
// Base url for the Detached Maps API
// "maps" is the the new API,
// "tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/tiles/layergroup|/u/:user/api/v1/map|/u/:user/tiles/layergroup)'
// Base url for the Inline Maps and Table Maps API
,base_url_legacy: '/tiles/:table'
,base_url_detached: '(?:/api/v1/map|/u/:user/api/v1/map)'
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors

View File

@ -14,13 +14,11 @@ var config = {
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/tiles/template|/u/:user/api/v1/map/named|/u/:user/tiles/template)'
,base_url_templated: '(?:/api/v1/map/named|/u/:user/api/v1/map/named)'
// Base url for the Detached Maps API
// "maps" is the the new API,
// "tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/tiles/layergroup|/u/:user/api/v1/map|/u/:user/tiles/layergroup)'
// Base url for the Inline Maps and Table Maps API
,base_url_legacy: '/tiles/:table'
,base_url_detached: '(?:/api/v1/map|/u/:user/api/v1/map)'
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors

View File

@ -14,13 +14,11 @@ var config = {
// Base url for the Templated Maps API
// "/api/v1/maps/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/tiles/template|/u/:user/api/v1/map/named|/u/:user/tiles/template)'
,base_url_templated: '(?:/api/v1/map/named|/u/:user/api/v1/map/named)'
// Base url for the Detached Maps API
// "/api/v1/maps" is the the new API,
// "/tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/tiles/layergroup|/u/:user/api/v1/map|/u/:user/tiles/layergroup)'
// Base url for the Inline Maps and Table Maps API
,base_url_legacy: '/tiles/:table'
,base_url_detached: '(?:/api/v1/map|/u/:user/api/v1/map)'
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors

View File

@ -14,13 +14,11 @@ var config = {
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/tiles/template|/u/:user/api/v1/map/named|/u/:user/tiles/template)'
,base_url_templated: '(?:/api/v1/map/named|/u/:user/api/v1/map/named)'
// Base url for the Detached Maps API
// "maps" is the the new API,
// "tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/tiles/layergroup|/u/:user/api/v1/map|/u/:user/tiles/layergroup)'
// Base url for the Inline Maps and Table Maps API
,base_url_legacy: '/tiles/:table'
,base_url_detached: '(?:/api/v1/map|/u/:user/api/v1/map)'
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors

View File

@ -56,7 +56,7 @@ suite('templates surrogate keys', function() {
function createTemplate(callback) {
var postTemplateRequest = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {
host: templateOwner,
@ -109,7 +109,7 @@ suite('templates surrogate keys', function() {
throw err;
}
var updateTemplateRequest = {
url: '/tiles/template/' + expectedTemplateId + '/?api_key=1234',
url: '/api/v1/map/named/' + expectedTemplateId + '/?api_key=1234',
method: 'PUT',
headers: {
host: templateOwner,
@ -174,7 +174,7 @@ suite('templates surrogate keys', function() {
throw err;
}
var deleteTemplateRequest = {
url: '/tiles/template/' + expectedTemplateId + '/?api_key=1234',
url: '/api/v1/map/named/' + expectedTemplateId + '/?api_key=1234',
method: 'DELETE',
headers: {
host: templateOwner,

View File

@ -22,7 +22,7 @@ serverOptions = ServerOptions();
var server = new CartodbWindshaft(serverOptions);
server.setMaxListeners(0);
['/tiles/layergroup', '/u/localhost/tiles/layergroup'].forEach(function(layergroup_url) {
['/api/v1/map', '/u/localhost/api/v1/map'].forEach(function(layergroup_url) {
var suiteName = 'multilayer:postgres=layergroup_url=' + layergroup_url;
suite(suiteName, function() {
@ -962,7 +962,7 @@ suite(suiteName, function() {
};
assert.response(server, {
url: '/tiles/layergroup?',
url: layergroup_url,
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup)
@ -995,7 +995,7 @@ suite(suiteName, function() {
};
assert.response(server, {
url: '/tiles/layergroup?',
url: layergroup_url,
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup)
@ -1018,7 +1018,7 @@ suite(suiteName, function() {
]
};
assert.response(server, {
url: '/tiles/layergroup?',
url: layergroup_url,
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(layergroup)

View File

@ -96,6 +96,7 @@ suite('named_layers', function() {
};
suiteSetup(function(done) {
global.environment.enabledFeatures = {cdbQueryTablesFromPostgres: true};
templateMaps.addTemplate(username, nestedNamedMapTemplate, function(err) {
if (err) {
return done(err);
@ -129,7 +130,7 @@ suite('named_layers', function() {
var next = this;
assert.response(server,
{
url: '/tiles/layergroup',
url: '/api/v1/map',
method: 'POST',
headers: {
host: 'localhost',
@ -182,7 +183,7 @@ suite('named_layers', function() {
var next = this;
assert.response(server,
{
url: '/tiles/layergroup',
url: '/api/v1/map',
method: 'POST',
headers: {
host: 'localhost',
@ -239,7 +240,7 @@ suite('named_layers', function() {
var next = this;
assert.response(server,
{
url: '/tiles/layergroup',
url: '/api/v1/map',
method: 'POST',
headers: {
host: 'localhost',
@ -292,7 +293,7 @@ suite('named_layers', function() {
var next = this;
assert.response(server,
{
url: '/tiles/layergroup',
url: '/api/v1/map',
method: 'POST',
headers: {
host: 'localhost',
@ -372,7 +373,7 @@ suite('named_layers', function() {
var next = this;
assert.response(server,
{
url: '/tiles/layergroup',
url: '/api/v1/map',
method: 'POST',
headers: {
host: 'localhost',
@ -407,7 +408,7 @@ suite('named_layers', function() {
var next = this;
assert.response(server,
{
url: '/tiles/layergroup/' + layergroupId + '/0/0/0.png',
url: '/api/v1/map/' + layergroupId + '/0/0/0.png',
method: 'GET',
headers: {
host: 'localhost'
@ -500,7 +501,7 @@ suite('named_layers', function() {
var next = this;
assert.response(server,
{
url: '/tiles/layergroup',
url: '/api/v1/map',
method: 'POST',
headers: {
host: 'localhost',
@ -535,7 +536,7 @@ suite('named_layers', function() {
var next = this;
assert.response(server,
{
url: '/tiles/layergroup/' + layergroupId + '/0/0/0.png',
url: '/api/v1/map/' + layergroupId + '/0/0/0.png',
method: 'GET',
headers: {
host: 'localhost'
@ -601,7 +602,7 @@ suite('named_layers', function() {
var next = this;
assert.response(server,
{
url: '/tiles/layergroup',
url: '/api/v1/map',
method: 'POST',
headers: {
host: 'localhost',
@ -636,6 +637,7 @@ suite('named_layers', function() {
suiteTeardown(function(done) {
global.environment.enabledFeatures = {cdbQueryTablesFromPostgres: false};
templateMaps.delTemplate(username, nestedNamedMapTemplateName, function(err) {
if (err) {
return done(err);

View File

@ -84,7 +84,7 @@ suite('template_api', function() {
var expected_failure = false;
var expected_tpl_id = "localhost@acceptance1";
var post_request_1 = {
url: '/tiles/template',
url: '/api/v1/map/named',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance1)
@ -171,7 +171,7 @@ suite('template_api', function() {
broken_template.auth.method = 'token';
delete broken_template.auth.tokens;
var post_request_1 = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(broken_template)
@ -201,7 +201,7 @@ suite('template_api', function() {
broken_template.auth.method = 'token';
broken_template.auth.tokens = [];
var post_request_1 = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(broken_template)
@ -228,7 +228,7 @@ suite('template_api', function() {
var broken_template = JSON.parse(JSON.stringify(template_acceptance1));
broken_template.name = 'broken1';
var post_request_1 = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(broken_template)
@ -252,7 +252,7 @@ suite('template_api', function() {
broken_template.auth.method = 'token';
broken_template.auth.tokens = [];
var put_request_1 = {
url: '/tiles/template/' + tpl_id + '/?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '/?api_key=1234',
method: 'PUT',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(broken_template)
@ -273,7 +273,7 @@ suite('template_api', function() {
'Error for invalid authentication on PUT does not match ' +
re + ': ' + parsed.error);
var del_request = {
url: '/tiles/template/' + tpl_id + '?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '?api_key=1234',
method: 'DELETE',
headers: {host: 'localhost'}
}
@ -309,7 +309,7 @@ suite('template_api', function() {
Step(function postTemplate1(err, res) {
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost.localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance1)
@ -318,7 +318,7 @@ suite('template_api', function() {
},
function testCORS() {
assert.response(server, {
url: '/tiles/template/acceptance1',
url: '/api/v1/map/named/acceptance1',
method: 'OPTIONS'
},{
status: 200,
@ -338,7 +338,7 @@ suite('template_api', function() {
Step(function postTemplate1(err, res) {
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(tmpl)
@ -350,7 +350,7 @@ suite('template_api', function() {
function testCORS() {
var next = this;
assert.response(server, {
url: '/tiles/template/' + tmpl.name,
url: '/api/v1/map/named/' + tmpl.name,
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
},{
@ -364,7 +364,7 @@ suite('template_api', function() {
function deleteTemplate(err) {
if ( err ) throw err;
var del_request = {
url: '/tiles/template/' + tmpl.name + '?api_key=1234',
url: '/api/v1/map/named/' + tmpl.name + '?api_key=1234',
method: 'DELETE',
headers: {host: 'localhost', 'Content-Type': 'application/json' }
}
@ -387,7 +387,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance1)
@ -408,7 +408,7 @@ suite('template_api', function() {
var backup_name = template_acceptance1.name;
template_acceptance1.name += '_new';
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance1)
@ -427,7 +427,7 @@ suite('template_api', function() {
tplid2 = parsed.template_id;
var next = this;
var get_request = {
url: '/tiles/template',
url: '/api/v1/map/named',
method: 'GET',
headers: {host: 'localhost'}
}
@ -445,7 +445,7 @@ suite('template_api', function() {
assert.ok(err.match(/authenticated user/), err);
var next = this;
var get_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'GET',
headers: {host: 'localhost'}
}
@ -504,7 +504,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(makeTemplate())
@ -523,7 +523,7 @@ suite('template_api', function() {
var backup_name = template_acceptance1.name;
template_acceptance1.name = 'changed_name';
var put_request = {
url: '/tiles/template/' + tpl_id + '/?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '/?api_key=1234',
method: 'PUT',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance1)
@ -542,7 +542,7 @@ suite('template_api', function() {
assert.ok(parsedBody.error.match(/cannot update name/i),
'Unexpected error for invalid update: ' + parsedBody.error);
var put_request = {
url: '/tiles/template/unexistent/?api_key=1234',
url: '/api/v1/map/named/unexistent/?api_key=1234',
method: 'PUT',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(makeTemplate())
@ -560,7 +560,7 @@ suite('template_api', function() {
assert.ok(parsedBody.error.match(/cannot update name/i),
'Unexpected error for invalid update: ' + parsedBody.error);
var put_request = {
url: '/tiles/template/' + tpl_id + '/?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '/?api_key=1234',
method: 'PUT',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(makeTemplate())
@ -616,7 +616,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(makeTemplate())
@ -633,7 +633,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
tpl_id = parsed.template_id;
var get_request = {
url: '/tiles/template/' + tpl_id,
url: '/api/v1/map/named/' + tpl_id,
method: 'GET',
headers: {host: 'localhost'}
}
@ -650,7 +650,7 @@ suite('template_api', function() {
assert.ok(parsedBody.error.match(/only.*authenticated.*user/i),
'Unexpected error for unauthenticated template get: ' + parsedBody.error);
var get_request = {
url: '/tiles/template/' + tpl_id + '?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '?api_key=1234',
method: 'GET',
headers: {host: 'localhost'}
}
@ -705,7 +705,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(makeTemplate())
@ -722,7 +722,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
tpl_id = parsed.template_id;
var get_request = {
url: '/tiles/template/' + tpl_id + '?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '?api_key=1234',
method: 'GET',
headers: {host: 'localhost'}
}
@ -739,7 +739,7 @@ suite('template_api', function() {
"Missing 'template' from response body: " + res.body);
assert.deepEqual(extendDefaultsTemplate(makeTemplate()), parsed.template);
var del_request = {
url: '/tiles/template/' + tpl_id,
url: '/api/v1/map/named/' + tpl_id,
method: 'DELETE',
headers: {host: 'localhost'}
}
@ -757,7 +757,7 @@ suite('template_api', function() {
assert.ok(parsed.error.match(/only.*authenticated.*user/i),
'Unexpected error for unauthenticated template get: ' + parsed.error);
var del_request = {
url: '/tiles/template/' + tpl_id + '?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '?api_key=1234',
method: 'DELETE',
headers: {host: 'localhost'}
}
@ -771,7 +771,7 @@ suite('template_api', function() {
assert.equal(res.statusCode, 204, res.statusCode + ': ' + res.body);
assert.ok(!res.body, 'Unexpected body in DELETE /template response');
var get_request = {
url: '/tiles/template/' + tpl_id + '?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '?api_key=1234',
method: 'GET',
headers: {host: 'localhost'}
}
@ -849,7 +849,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance2)
@ -866,7 +866,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
tpl_id = parsed.template_id;
var post_request = {
url: '/tiles/template/' + tpl_id,
url: '/api/v1/map/named/' + tpl_id,
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -887,7 +887,7 @@ suite('template_api', function() {
assert.ok(parsed.error.match(/unauthorized/i),
'Unexpected error for unauthorized instance : ' + parsed.error);
var post_request = {
url: '/tiles/template/' + tpl_id + '?auth_token=valid2',
url: '/api/v1/map/named/' + tpl_id + '?auth_token=valid2',
method: 'POST',
headers: {host: 'foreign', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -906,7 +906,7 @@ suite('template_api', function() {
assert.ok(parsed.error.match(/cannot instanciate/i),
'Unexpected error for forbidden instance : ' + parsed.error);
var post_request = {
url: '/tiles/template/' + tpl_id + '?auth_token=valid2',
url: '/api/v1/map/named/' + tpl_id + '?auth_token=valid2',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -930,7 +930,7 @@ suite('template_api', function() {
"Missing 'last_updated' from response body: " + res.body);
// TODO: check value of last_updated ?
var get_request = {
url: '/tiles/layergroup/' + layergroupid + ':cb0/0/0/0.png',
url: '/api/v1/map/' + layergroupid + ':cb0/0/0/0.png',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -950,7 +950,7 @@ suite('template_api', function() {
'Unexpected error for unauthorized instance '
+ '(expected /permission denied/): ' + parsed.error);
var get_request = {
url: '/tiles/layergroup/' + layergroupid + '/0/0/0.png?auth_token=valid1',
url: '/api/v1/map/' + layergroupid + '/0/0/0.png?auth_token=valid1',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -972,7 +972,7 @@ suite('template_api', function() {
if ( err ) throw err;
var foreignsigned = layergroupid.replace(/[^@]*@/, 'foreign@');
var get_request = {
url: '/tiles/layergroup/' + foreignsigned + '/0/0/0.png?auth_token=valid1',
url: '/api/v1/map/' + foreignsigned + '/0/0/0.png?auth_token=valid1',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -998,7 +998,7 @@ suite('template_api', function() {
{
if ( err ) throw err;
var del_request = {
url: '/tiles/template/' + tpl_id + '?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '?api_key=1234',
method: 'DELETE',
headers: {host: 'localhost'}
}
@ -1011,7 +1011,7 @@ suite('template_api', function() {
assert.equal(res.statusCode, 204,
'Deleting template: ' + res.statusCode + ':' + res.body);
var get_request = {
url: '/tiles/layergroup/' + layergroupid + '/0/0/0.png?auth_token=valid1',
url: '/api/v1/map/' + layergroupid + '/0/0/0.png?auth_token=valid1',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -1083,7 +1083,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template)
@ -1100,7 +1100,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
tpl_id = parsed.template_id;
var post_request = {
url: '/tiles/template/' + tpl_id,
url: '/api/v1/map/named/' + tpl_id,
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -1121,7 +1121,7 @@ suite('template_api', function() {
assert.ok(parsed.error.match(/unauthorized/i),
'Unexpected error for unauthorized instance : ' + parsed.error);
var post_request = {
url: '/tiles/template/' + tpl_id + '?auth_token=valid2',
url: '/api/v1/map/named/' + tpl_id + '?auth_token=valid2',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -1145,7 +1145,7 @@ suite('template_api', function() {
"Missing 'last_updated' from response body: " + res.body);
// TODO: check value of last_updated ?
var get_request = {
url: '/tiles/layergroup/' + layergroupid + ':cb0/0/0/0/0.json.torque',
url: '/api/v1/map/' + layergroupid + ':cb0/0/0/0/0.json.torque',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -1165,7 +1165,7 @@ suite('template_api', function() {
'Unexpected error for unauthorized instance '
+ '(expected /permission denied): ' + parsed.error);
var get_request = {
url: '/tiles/layergroup/' + layergroupid + ':cb1/0/0/0/0.json.torque?auth_token=valid1',
url: '/api/v1/map/' + layergroupid + ':cb1/0/0/0/0.json.torque?auth_token=valid1',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -1187,7 +1187,7 @@ suite('template_api', function() {
serverOptions = ServerOptions(); // need to clean channel cache
server = new CartodbWindshaft(serverOptions);
var get_request = {
url: '/tiles/layergroup/' + layergroupid + ':cb1/0/0/0/1.json.torque?auth_token=valid1',
url: '/api/v1/map/' + layergroupid + ':cb1/0/0/0/1.json.torque?auth_token=valid1',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -1211,7 +1211,7 @@ suite('template_api', function() {
{
if ( err ) throw err;
var del_request = {
url: '/tiles/template/' + tpl_id + '?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '?api_key=1234',
method: 'DELETE',
headers: {host: 'localhost'}
}
@ -1224,7 +1224,7 @@ suite('template_api', function() {
assert.equal(res.statusCode, 204,
'Deleting template: ' + res.statusCode + ':' + res.body);
var get_request = {
url: '/tiles/layergroup/' + layergroupid + ':cb2/0/0/0/0.json.torque?auth_token=valid1',
url: '/api/v1/map/' + layergroupid + ':cb2/0/0/0/0.json.torque?auth_token=valid1',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -1298,7 +1298,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template)
@ -1315,7 +1315,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
tpl_id = parsed.template_id;
var post_request = {
url: '/tiles/template/' + tpl_id,
url: '/api/v1/map/named/' + tpl_id,
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -1336,7 +1336,7 @@ suite('template_api', function() {
assert.ok(parsed.error.match(/unauthorized/i),
'Unexpected error for unauthorized instance : ' + parsed.error);
var post_request = {
url: '/tiles/template/' + tpl_id + '?auth_token=valid2',
url: '/api/v1/map/named/' + tpl_id + '?auth_token=valid2',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -1360,7 +1360,7 @@ suite('template_api', function() {
"Missing 'last_updated' from response body: " + res.body);
// TODO: check value of last_updated ?
var get_request = {
url: '/tiles/layergroup/' + layergroupid + ':cb0/0/attributes/5',
url: '/api/v1/map/' + layergroupid + ':cb0/0/attributes/5',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -1380,7 +1380,7 @@ suite('template_api', function() {
'Unexpected error for unauthorized getAttributes '
+ '(expected /permission denied/): ' + parsed.error);
var get_request = {
url: '/tiles/layergroup/' + layergroupid + ':cb1/0/attributes/5?auth_token=valid2',
url: '/api/v1/map/' + layergroupid + ':cb1/0/attributes/5?auth_token=valid2',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -1401,7 +1401,7 @@ suite('template_api', function() {
{
if ( err ) throw err;
var del_request = {
url: '/tiles/template/' + tpl_id + '?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '?api_key=1234',
method: 'DELETE',
headers: {host: 'localhost'}
}
@ -1414,7 +1414,7 @@ suite('template_api', function() {
assert.equal(res.statusCode, 204,
'Deleting template: ' + res.statusCode + ':' + res.body);
var get_request = {
url: '/tiles/layergroup/' + layergroupid + ':cb2/0/attributes/5?auth_token=valid2',
url: '/api/v1/map/' + layergroupid + ':cb2/0/attributes/5?auth_token=valid2',
method: 'GET',
headers: {host: 'localhost' },
encoding: 'binary'
@ -1488,7 +1488,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance_open)
@ -1505,7 +1505,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
tpl_id = parsed.template_id;
var post_request = {
url: '/tiles/template/' + tpl_id,
url: '/api/v1/map/named/' + tpl_id,
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -1557,7 +1557,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance_open)
@ -1574,7 +1574,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
tpl_id = parsed.template_id;
var post_request = {
url: '/tiles/template/' + tpl_id + "/jsonp?callback=test",
url: '/api/v1/map/named/' + tpl_id + "/jsonp?callback=test",
method: 'GET',
headers: {host: 'localhost' }
}
@ -1631,7 +1631,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance_open)
@ -1648,7 +1648,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
tpl_id = parsed.template_id;
var post_request = {
url: '/tiles/template/' + tpl_id + "/jsonp?callback=test%config=" + JSON.stringify('{color:blue}'),
url: '/api/v1/map/named/' + tpl_id + "/jsonp?callback=test%config=" + JSON.stringify('{color:blue}'),
method: 'GET',
headers: {host: 'localhost' }
}
@ -1709,7 +1709,7 @@ suite('template_api', function() {
{
if ( err ) throw err;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template)
@ -1723,7 +1723,7 @@ suite('template_api', function() {
assert.equal(res.statusCode, 200, res.body);
template_id = JSON.parse(res.body).template_id;
var post_request = {
url: '/tiles/template/' + template_id,
url: '/api/v1/map/named/' + template_id,
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify({})
@ -1758,7 +1758,7 @@ suite('template_api', function() {
{
if ( err ) throw err;
var del_request = {
url: '/tiles/template/' + template_id + '?api_key=1234',
url: '/api/v1/map/named/' + template_id + '?api_key=1234',
method: 'DELETE',
headers: {host: 'localhost'}
}
@ -1811,7 +1811,7 @@ suite('template_api', function() {
{
var next = this;
var post_request = {
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_acceptance2)
@ -1828,7 +1828,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
tpl_id = parsed.template_id;
var post_request = {
url: '/tiles/template/' + tpl_id + '?auth_token=valid2',
url: '/api/v1/map/named/' + tpl_id + '?auth_token=valid2',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -1855,7 +1855,7 @@ suite('template_api', function() {
var changedTemplate = JSON.parse(JSON.stringify(template_acceptance2));
changedTemplate.auth.method = 'open';
var post_request = {
url: '/tiles/template/' + tpl_id + '/?api_key=1234',
url: '/api/v1/map/named/' + tpl_id + '/?api_key=1234',
method: 'PUT',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(changedTemplate)
@ -1873,7 +1873,7 @@ suite('template_api', function() {
"Missing 'template_id' from response body: " + res.body);
assert.equal(tpl_id, parsed.template_id);
var post_request = {
url: '/tiles/template/' + tpl_id + '?auth_token=valid2',
url: '/api/v1/map/named/' + tpl_id + '?auth_token=valid2',
method: 'POST',
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(template_params)
@ -1968,7 +1968,7 @@ suite('template_api', function() {
assert.response(
server,
{
url: '/tiles/template?api_key=1234',
url: '/api/v1/map/named?api_key=1234',
method: 'POST',
headers: {
host: username,
@ -1993,7 +1993,7 @@ suite('template_api', function() {
assert.response(
server,
{
url: '/tiles/template/' + expectedTemplateId,
url: '/api/v1/map/named/' + expectedTemplateId,
method: 'POST',
headers: {
host: username,
@ -2022,7 +2022,7 @@ suite('template_api', function() {
assert.response(
server,
{
url: '/tiles/layergroup/' + layergroupid + '/all/0/0/0.png',
url: '/api/v1/map/' + layergroupid + '/all/0/0/0.png',
method: 'GET',
headers: {
host: username
@ -2052,7 +2052,7 @@ suite('template_api', function() {
assert.response(
server,
{
url: '/tiles/template/' + expectedTemplateId + '?api_key=1234',
url: '/api/v1/map/named/' + expectedTemplateId + '?api_key=1234',
method: 'DELETE',
headers: {
host: username