Rename from app to server
Removes app_root dependency in requires
This commit is contained in:
parent
97ac1b8db6
commit
f92d50cccf
8
app.js
8
app.js
@ -69,8 +69,8 @@ if ( ! global.settings.base_url ) {
|
||||
|
||||
var version = require("./package").version;
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
app.listen(global.settings.node_port, global.settings.node_host, function() {
|
||||
var server = require('app/server')();
|
||||
server.listen(global.settings.node_port, global.settings.node_host, function() {
|
||||
console.log(
|
||||
"CartoDB SQL API %s listening on %s:%s with base_url %s (%s)",
|
||||
version, global.settings.node_host, global.settings.node_port, global.settings.base_url, ENV
|
||||
@ -90,8 +90,8 @@ process.on('SIGHUP', function() {
|
||||
});
|
||||
|
||||
process.on('SIGTERM', function () {
|
||||
app.batch.stop();
|
||||
app.batch.drain(function (err) {
|
||||
server.batch.stop();
|
||||
server.batch.drain(function (err) {
|
||||
if (err) {
|
||||
console.log('Exit with error');
|
||||
return process.exit(1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
|
||||
describe('app.auth', function() {
|
||||
@ -40,7 +40,7 @@ describe('app.auth', function() {
|
||||
|
||||
scenarios.forEach(function(scenario) {
|
||||
it(scenario.desc, function(done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
// view prepare_db.sh to find public table name and structure
|
||||
url: scenario.url,
|
||||
headers: {
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var querystring = require('querystring');
|
||||
var _ = require('underscore');
|
||||
@ -28,7 +28,7 @@ var expected_rw_cache_control = 'no-cache,max-age=0,must-revalidate,public';
|
||||
var expected_cache_control_persist = 'public,max-age=31536000';
|
||||
|
||||
it('GET /api/v1/version', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/version',
|
||||
method: 'GET'
|
||||
},{}, function(res) {
|
||||
@ -42,7 +42,7 @@ it('GET /api/v1/version', function(done){
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
method: 'GET'
|
||||
},{
|
||||
@ -57,7 +57,7 @@ it('GET /api/v1/sql', function(done){
|
||||
|
||||
// Test base_url setting
|
||||
it('GET /api/whatever/sql', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/whatever/sql?q=SELECT%201',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -70,7 +70,7 @@ it('GET /api/whatever/sql', function(done){
|
||||
|
||||
// Test CORS headers with GET
|
||||
it('GET /api/whatever/sql', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/whatever/sql?q=SELECT%201',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -87,7 +87,7 @@ it('GET /api/whatever/sql', function(done){
|
||||
|
||||
// Test that OPTIONS does not run queries
|
||||
it('OPTIONS /api/x/sql', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/x/sql?q=syntax%20error',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'OPTIONS'
|
||||
@ -105,7 +105,7 @@ it('OPTIONS /api/x/sql', function(done){
|
||||
|
||||
|
||||
it('GET /api/v1/sql with SQL parameter on SELECT only. No oAuth included ', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&database=cartodb_test_user_1_db',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -119,7 +119,7 @@ it('GET /api/v1/sql with SQL parameter on SELECT only. No oAuth included ', func
|
||||
});
|
||||
|
||||
it('cache_policy=persist', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&database=cartodb_test_user_1_db&cache_policy=persist',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -135,7 +135,7 @@ it('cache_policy=persist', function(done){
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql with SQL parameter on SELECT only. no database param, just id using headers', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -146,7 +146,7 @@ it('GET /api/v1/sql with SQL parameter on SELECT only. no database param, just i
|
||||
});
|
||||
|
||||
it('GET /user/vizzuality/api/v1/sql with SQL parameter on SELECT only', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/user/vizzuality/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4',
|
||||
method: 'GET'
|
||||
},{ }, function(res) {
|
||||
@ -160,7 +160,7 @@ it('GET /user/vizzuality/api/v1/sql with SQL parameter on SELECT only', function
|
||||
it('SELECT from user-specific database', function(done){
|
||||
var backupDBHost = global.settings.db_host;
|
||||
global.settings.db_host = '6.6.6.6';
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT+2+as+n',
|
||||
headers: {host: 'cartodb250user.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -183,7 +183,7 @@ it('SELECT from user-specific database', function(done){
|
||||
it('SELECT with user-specific password', function(done){
|
||||
var backupDBUserPass = global.settings.db_user_pass;
|
||||
global.settings.db_user_pass = '<%= user_password %>';
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT+2+as+n&api_key=1234',
|
||||
headers: {host: 'cartodb250user.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -204,7 +204,7 @@ it('SELECT with user-specific password', function(done){
|
||||
|
||||
it('GET /api/v1/sql with SQL parameter on SELECT only. no database param, just id using headers. Authenticated.',
|
||||
function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20cartodb_id*2%20FROM%20untitle_table_4&api_key=1234',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -220,7 +220,7 @@ function(done){
|
||||
// Test for https://github.com/Vizzuality/CartoDB-SQL-API/issues/85
|
||||
it("paging doesn't break x-cache-channel",
|
||||
function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
// note: select casing intentionally mixed
|
||||
q: 'selECT cartodb_id*3 FROM untitle_table_4',
|
||||
@ -290,7 +290,7 @@ it("paging", function(done){
|
||||
req.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
req.data = data;
|
||||
}
|
||||
assert.response(app, req, {}, function(res) {
|
||||
assert.response(server, req, {}, function(res) {
|
||||
assert.equal(res.statusCode, 200, res.body);
|
||||
var parsed = JSON.parse(res.body);
|
||||
assert.equal(parsed.rows.length, nrows);
|
||||
@ -311,7 +311,7 @@ it("paging starting with comment", function(done){
|
||||
"SELECT * FROM (VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9)) t(v)";
|
||||
var nrows = 3;
|
||||
var page = 2;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: sql,
|
||||
rows_per_page: nrows,
|
||||
@ -333,7 +333,7 @@ it("paging starting with comment", function(done){
|
||||
});
|
||||
|
||||
it('POST /api/v1/sql with SQL parameter on SELECT only. no database param, just id using headers', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: querystring.stringify({q: "SELECT * FROM untitle_table_4"}),
|
||||
headers: {host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
@ -345,7 +345,7 @@ it('POST /api/v1/sql with SQL parameter on SELECT only. no database param, just
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql with INSERT. oAuth not used, so public user - should fail', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?q=INSERT%20INTO%20untitle_table_4%20(cartodb_id)%20VALUES%20(1e4)" +
|
||||
"&database=cartodb_test_user_1_db",
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
@ -363,7 +363,7 @@ it('GET /api/v1/sql with INSERT. oAuth not used, so public user - should fail',
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql with DROP TABLE. oAuth not used, so public user - should fail', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?q=DROP%20TABLE%20untitle_table_4&database=cartodb_test_user_1_db",
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -380,7 +380,7 @@ it('GET /api/v1/sql with DROP TABLE. oAuth not used, so public user - should fai
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql with INSERT. header based db - should fail', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?q=INSERT%20INTO%20untitle_table_4%20(id)%20VALUES%20(1)",
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -395,7 +395,7 @@ it('GET /api/v1/sql with INSERT. header based db - should fail', function (done)
|
||||
//
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/13
|
||||
it('INSERT returns affected rows', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
// view prepare_db.sh to see where to set api_key
|
||||
url: "/api/v1/sql?api_key=1234&" + querystring.stringify({q:
|
||||
"INSERT INTO private_table(name) VALUES('noret1') UNION VALUES('noret2')"
|
||||
@ -420,7 +420,7 @@ it('INSERT returns affected rows', function(done){
|
||||
//
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/13
|
||||
it('UPDATE returns affected rows', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
// view prepare_db.sh to see where to set api_key
|
||||
url: "/api/v1/sql?api_key=1234&" + querystring.stringify({q:
|
||||
"UPDATE private_table SET name = upper(name) WHERE name in ('noret1', 'noret2')"
|
||||
@ -445,7 +445,7 @@ it('UPDATE returns affected rows', function(done){
|
||||
//
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/13
|
||||
it('DELETE returns affected rows', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
// view prepare_db.sh to see where to set api_key
|
||||
url: "/api/v1/sql?api_key=1234&" + querystring.stringify({q:
|
||||
"DELETE FROM private_table WHERE name in ('NORET1', 'NORET2')"
|
||||
@ -470,7 +470,7 @@ it('DELETE returns affected rows', function(done){
|
||||
//
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/50
|
||||
it('INSERT with RETURNING returns all results', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
// view prepare_db.sh to see where to set api_key
|
||||
url: "/api/v1/sql?api_key=1234&" + querystring.stringify({q:
|
||||
"INSERT INTO private_table(name) VALUES('test') RETURNING upper(name), reverse(name)"
|
||||
@ -494,7 +494,7 @@ it('INSERT with RETURNING returns all results', function(done){
|
||||
//
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/50
|
||||
it('UPDATE with RETURNING returns all results', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
// view prepare_db.sh to see where to set api_key
|
||||
url: "/api/v1/sql?api_key=1234&" + querystring.stringify({q:
|
||||
"UPDATE private_table SET name = 'tost' WHERE name = 'test' RETURNING upper(name), reverse(name)"
|
||||
@ -518,7 +518,7 @@ it('UPDATE with RETURNING returns all results', function(done){
|
||||
//
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/50
|
||||
it('DELETE with RETURNING returns all results', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
// view prepare_db.sh to see where to set api_key
|
||||
url: "/api/v1/sql?api_key=1234&" + querystring.stringify({q:
|
||||
"DELETE FROM private_table WHERE name = 'tost' RETURNING name"
|
||||
@ -538,7 +538,7 @@ it('DELETE with RETURNING returns all results', function(done){
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql with SQL parameter on DROP TABLE. should fail', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?q=DROP%20TABLE%20untitle_table_4",
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -557,7 +557,7 @@ it('GET /api/v1/sql with SQL parameter on DROP TABLE. should fail', function(don
|
||||
//
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/99
|
||||
it('Field name is not confused with UPDATE operation', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
// view prepare_db.sh to see where to set api_key
|
||||
url: "/api/v1/sql?api_key=1234&" + querystring.stringify({q:
|
||||
"SELECT min(updated_at) FROM private_table"
|
||||
@ -572,7 +572,7 @@ it('Field name is not confused with UPDATE operation', function(done){
|
||||
});
|
||||
|
||||
it('CREATE TABLE with GET and auth', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'CREATE TABLE test_table(a int)',
|
||||
api_key: 1234
|
||||
@ -595,7 +595,7 @@ it('SELECT INTO with paging ', function(done){
|
||||
step(
|
||||
function select_into() {
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'SELECT generate_series(1,10) InTO "' + esc_tabname + '"',
|
||||
rows_per_page: 1, page: 1,
|
||||
@ -609,7 +609,7 @@ it('SELECT INTO with paging ', function(done){
|
||||
assert.ifError(err);
|
||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'SELECT \' INTO "c"\' FROM "' + esc_tabname + '"',
|
||||
rows_per_page: 1, page: 1,
|
||||
@ -625,7 +625,7 @@ it('SELECT INTO with paging ', function(done){
|
||||
var out = JSON.parse(res.body);
|
||||
assert.equal(out.total_rows, 1); // windowing works
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'DROP TABLE "' + esc_tabname + '"',
|
||||
api_key: 1234
|
||||
@ -648,7 +648,7 @@ it('SELECT INTO with paging ', function(done){
|
||||
// Test effects of COPY
|
||||
// See https://github.com/Vizzuality/cartodb-management/issues/1502
|
||||
it('COPY TABLE with GET and auth', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'COPY test_table FROM stdin;',
|
||||
api_key: 1234
|
||||
@ -666,7 +666,7 @@ it('COPY TABLE with GET and auth', function(done){
|
||||
});
|
||||
|
||||
it('COPY TABLE with GET and auth', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: "COPY test_table to '/tmp/x';",
|
||||
api_key: 1234
|
||||
@ -687,7 +687,7 @@ it('COPY TABLE with GET and auth', function(done){
|
||||
});
|
||||
|
||||
it('ALTER TABLE with GET and auth', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'ALTER TABLE test_table ADD b int',
|
||||
api_key: 1234
|
||||
@ -705,7 +705,7 @@ it('ALTER TABLE with GET and auth', function(done){
|
||||
});
|
||||
|
||||
it('multistatement insert, alter, select, begin, commit', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'BEGIN; DELETE FROM test_table; COMMIT; BEGIN; INSERT INTO test_table(b) values (5); COMMIT; ' +
|
||||
'ALTER TABLE test_table ALTER b TYPE float USING b::float/2; SELECT b FROM test_table;',
|
||||
@ -723,7 +723,7 @@ it('multistatement insert, alter, select, begin, commit', function(done){
|
||||
});
|
||||
|
||||
it('TRUNCATE TABLE with GET and auth', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'TRUNCATE TABLE test_table',
|
||||
api_key: 1234
|
||||
@ -736,7 +736,7 @@ it('TRUNCATE TABLE with GET and auth', function(done){
|
||||
assert.equal(res.headers['cache-control'], expected_rw_cache_control);
|
||||
var pbody = JSON.parse(res.body);
|
||||
assert.equal(pbody.rows.length, 0);
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'SELECT count(*) FROM test_table',
|
||||
api_key: 1234
|
||||
@ -757,7 +757,7 @@ it('TRUNCATE TABLE with GET and auth', function(done){
|
||||
});
|
||||
|
||||
it('REINDEX TABLE with GET and auth', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: ' ReINdEX TABLE test_table',
|
||||
api_key: 1234
|
||||
@ -775,7 +775,7 @@ it('REINDEX TABLE with GET and auth', function(done){
|
||||
});
|
||||
|
||||
it('DROP TABLE with GET and auth', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'DROP TABLE test_table',
|
||||
api_key: 1234
|
||||
@ -793,7 +793,7 @@ it('DROP TABLE with GET and auth', function(done){
|
||||
});
|
||||
|
||||
it('CREATE FUNCTION with GET and auth', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'CREATE FUNCTION create_func_test(a int) RETURNS INT AS \'SELECT 1\' LANGUAGE \'sql\'',
|
||||
api_key: 1234
|
||||
@ -811,7 +811,7 @@ it('CREATE FUNCTION with GET and auth', function(done){
|
||||
});
|
||||
|
||||
it('DROP FUNCTION with GET and auth', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: 'DROP FUNCTION create_func_test(a int)',
|
||||
api_key: 1234
|
||||
@ -829,7 +829,7 @@ it('DROP FUNCTION with GET and auth', function(done){
|
||||
});
|
||||
|
||||
it('sends a 400 when an unsupported format is requested', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&format=unknown',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -843,7 +843,7 @@ it('sends a 400 when an unsupported format is requested', function(done){
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql with SQL parameter and no format, ensuring content-disposition set to json', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -859,7 +859,7 @@ it('GET /api/v1/sql with SQL parameter and no format, ensuring content-dispositi
|
||||
});
|
||||
|
||||
it('POST /api/v1/sql with SQL parameter and no format, ensuring content-disposition set to json', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: querystring.stringify({q: "SELECT * FROM untitle_table_4" }),
|
||||
headers: {host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
@ -876,7 +876,7 @@ it('POST /api/v1/sql with SQL parameter and no format, ensuring content-disposit
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql with SQL parameter and no format, but a filename', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&filename=x',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -892,7 +892,7 @@ it('GET /api/v1/sql with SQL parameter and no format, but a filename', function(
|
||||
});
|
||||
|
||||
it('field named "the_geom_webmercator" is not skipped by default', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -912,7 +912,7 @@ it('field named "the_geom_webmercator" is not skipped by default', function(done
|
||||
});
|
||||
|
||||
it('skipfields controls included fields', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&skipfields=the_geom_webmercator,cartodb_id,unexistant',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -932,7 +932,7 @@ it('skipfields controls included fields', function(done){
|
||||
});
|
||||
|
||||
it('multiple skipfields parameter do not kill the backend', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&skipfields=unexistent,the_geom_webmercator' +
|
||||
'&skipfields=cartodb_id,unexistant',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
@ -953,7 +953,7 @@ it('multiple skipfields parameter do not kill the backend', function(done){
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql ensure cross domain set on errors', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*gadfgadfg%20FROM%20untitle_table_4',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -1022,7 +1022,7 @@ function testSystemQueries(description, queries, statusErrorCode, apiKey) {
|
||||
method: 'GET',
|
||||
url: '/api/v1/sql?' + querystring.stringify(queryStringParams)
|
||||
};
|
||||
assert.response(app, request, function(response) {
|
||||
assert.response(server, request, function(response) {
|
||||
assert.equal(response.statusCode, statusErrorCode);
|
||||
done();
|
||||
});
|
||||
@ -1031,7 +1031,7 @@ function testSystemQueries(description, queries, statusErrorCode, apiKey) {
|
||||
}
|
||||
|
||||
it('GET decent error if domain is incorrect', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&format=geojson',
|
||||
headers: {host: 'vizzualinot.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -1050,7 +1050,7 @@ it('GET decent error if domain is incorrect', function(done){
|
||||
|
||||
// this test does not make sense with the current CDB_QueryTables implementation
|
||||
it('GET decent error if SQL is broken', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({q:
|
||||
'SELECT star FROM this and that'
|
||||
}),
|
||||
@ -1069,7 +1069,7 @@ it('GET decent error if SQL is broken', function(done){
|
||||
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/88
|
||||
it('numeric arrays are rendered as such', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?" + querystring.stringify({q:
|
||||
"SELECT ARRAY[8.7,4.3]::numeric[] as x"
|
||||
}),
|
||||
@ -1092,7 +1092,7 @@ it('numeric arrays are rendered as such', function(done){
|
||||
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/97
|
||||
it('field names and types are exposed', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SELECT 1::int as a, 2::float8 as b, 3::varchar as c, " +
|
||||
"4::char as d, now() as e, 'a'::text as f" +
|
||||
@ -1125,7 +1125,7 @@ it('field names and types are exposed', function(done){
|
||||
|
||||
// See https://github.com/CartoDB/CartoDB-SQL-API/issues/109
|
||||
it('schema response takes skipfields into account', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SELECT 1 as a, 2 as b, 3 as c ",
|
||||
skipfields: 'b'
|
||||
@ -1145,7 +1145,7 @@ it('schema response takes skipfields into account', function(done){
|
||||
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/100
|
||||
it('numeric fields are rendered as numbers in JSON', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "WITH inp AS ( SELECT 1::int2 as a, 2::int4 as b, " +
|
||||
"3::int8 as c, 4::float4 as d, " +
|
||||
@ -1196,7 +1196,7 @@ it('timezone info in JSON output', function(done){
|
||||
step(
|
||||
function testEuropeRomeExplicit() {
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SET timezone TO 'Europe/Rome'; SELECT '2000-01-01T00:00:00+01'::timestamptz as d"
|
||||
}),
|
||||
@ -1216,7 +1216,7 @@ it('timezone info in JSON output', function(done){
|
||||
function testEuropeRomeImplicit(err) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SET timezone TO 'Europe/Rome'; SELECT '2000-01-01T00:00:00'::timestamp as d"
|
||||
}),
|
||||
@ -1236,7 +1236,7 @@ it('timezone info in JSON output', function(done){
|
||||
function testUTCExplicit(err) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SET timezone TO 'UTC'; SELECT '2000-01-01T00:00:00+00'::timestamptz as d"
|
||||
}),
|
||||
@ -1256,7 +1256,7 @@ it('timezone info in JSON output', function(done){
|
||||
function testUTCImplicit(err) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SET timezone TO 'UTC'; SELECT '2000-01-01T00:00:00'::timestamp as d"
|
||||
}),
|
||||
@ -1285,7 +1285,7 @@ it('notice and warning info in JSON output', function(done){
|
||||
step(
|
||||
function addRaiseFunction() {
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "create or replace function raise(lvl text, msg text) returns void as $$ begin if lvl = 'notice' " +
|
||||
"then raise notice '%', msg; elsif lvl = 'warning' then raise warning '%', msg; " +
|
||||
@ -1305,7 +1305,7 @@ it('notice and warning info in JSON output', function(done){
|
||||
function raiseNotice(err) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SET client_min_messages TO 'notice'; select raise('notice', 'hello notice')"
|
||||
}),
|
||||
@ -1326,7 +1326,7 @@ it('notice and warning info in JSON output', function(done){
|
||||
function raiseWarning(err) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SET client_min_messages TO 'notice'; select raise('warning', 'hello warning')"
|
||||
}),
|
||||
@ -1347,7 +1347,7 @@ it('notice and warning info in JSON output', function(done){
|
||||
function raiseBothWarningAndNotice(err) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SET client_min_messages TO 'notice'; select raise('warning', 'hello again warning'), " +
|
||||
"raise('notice', 'hello again notice');"
|
||||
@ -1371,7 +1371,7 @@ it('notice and warning info in JSON output', function(done){
|
||||
},
|
||||
function delRaiseFunction(err) {
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "DROP function raise(text, text)",
|
||||
api_key: '1234'
|
||||
@ -1396,7 +1396,7 @@ it('notice and warning info in JSON output', function(done){
|
||||
* CORS
|
||||
*/
|
||||
it('GET /api/v1/sql with SQL parameter on SELECT only should return CORS headers ', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&database=cartodb_test_user_1_db',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -1415,7 +1415,7 @@ it('GET /api/v1/sql with SQL parameter on SELECT only should return CORS headers
|
||||
});
|
||||
|
||||
it('GET with callback param returns wrapped result set with callback as jsonp', function(done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&callback=foo_jsonp',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -1427,7 +1427,7 @@ it('GET with callback param returns wrapped result set with callback as jsonp',
|
||||
});
|
||||
|
||||
it('GET with callback must return 200 status error even if it is an error', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?q=DROP%20TABLE%20untitle_table_4&callback=foo_jsonp",
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -1447,7 +1447,7 @@ it('GET with callback must return 200 status error even if it is an error', func
|
||||
});
|
||||
|
||||
it('GET with slow query exceeding statement timeout returns proper error message', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: "/api/v1/sql?q=select%20pg_sleep(2.1)%20as%20sleep",
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -1474,7 +1474,7 @@ it('GET with callback must return 200 status error even if it is an error', func
|
||||
consoleError = what;
|
||||
};
|
||||
assert.response(
|
||||
app,
|
||||
server,
|
||||
{
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: "SELECT * FROM untitle_table_4"
|
||||
|
@ -27,11 +27,11 @@ it('does not hang server', function(done){
|
||||
var db_port_backup = global.settings.db_port;
|
||||
global.settings.db_host = 'localhost';
|
||||
global.settings.db_port = sql_server_port;
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
step(
|
||||
function sendQuery() {
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT+1',
|
||||
method: 'GET',
|
||||
headers: {host: 'vizzuality.localhost' }
|
||||
@ -50,7 +50,7 @@ it('does not hang server', function(done){
|
||||
},
|
||||
function sendAnotherQuery() {
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT+2',
|
||||
method: 'GET',
|
||||
headers: {host: 'vizzuality.localhost' }
|
||||
|
@ -2,17 +2,17 @@ require('../../helper');
|
||||
require('../../support/assert');
|
||||
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../../app/server')();
|
||||
var assert = require('assert');
|
||||
var querystring = require('querystring');
|
||||
|
||||
// allow lots of emitters to be set to silence warning
|
||||
app.setMaxListeners(0);
|
||||
server.setMaxListeners(0);
|
||||
|
||||
describe('export.arraybuffer', function() {
|
||||
|
||||
it('GET /api/v1/sql as arraybuffer ', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: 'SELECT cartodb_id,name,1::integer,187.9 FROM untitle_table_4',
|
||||
format: 'arraybuffer'
|
||||
@ -27,7 +27,7 @@ it('GET /api/v1/sql as arraybuffer ', function(done){
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql as arraybuffer does not support geometry types ', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: 'SELECT cartodb_id, the_geom FROM untitle_table_4',
|
||||
format: 'arraybuffer'
|
||||
|
@ -2,17 +2,17 @@ require('../../helper');
|
||||
require('../../support/assert');
|
||||
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../../app/server')();
|
||||
var assert = require('assert');
|
||||
var querystring = require('querystring');
|
||||
|
||||
// allow lots of emitters to be set to silence warning
|
||||
app.setMaxListeners(0);
|
||||
server.setMaxListeners(0);
|
||||
|
||||
describe('export.csv', function() {
|
||||
|
||||
it('CSV format', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: 'SELECT * FROM untitle_table_4 WHERE cartodb_id = 1',
|
||||
format: 'csv'
|
||||
@ -39,7 +39,7 @@ it('CSV format', function(done){
|
||||
});
|
||||
|
||||
it('CSV format, bigger than 81920 bytes', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: querystring.stringify({
|
||||
q: 'SELECT 0 as fname FROM generate_series(0,81920)',
|
||||
@ -55,7 +55,7 @@ it('CSV format, bigger than 81920 bytes', function(done){
|
||||
|
||||
|
||||
it('CSV format from POST', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: querystring.stringify({q: "SELECT * FROM untitle_table_4 LIMIT 1", format: 'csv'}),
|
||||
headers: {host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
@ -72,7 +72,7 @@ it('CSV format from POST', function(done){
|
||||
});
|
||||
|
||||
it('CSV format, custom filename', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=csv&filename=mycsv.csv',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -98,7 +98,7 @@ it('CSV format, custom filename', function(done){
|
||||
});
|
||||
|
||||
it('skipfields controls fields included in CSV output', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=csv' +
|
||||
'&skipfields=unexistant,cartodb_id',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
@ -120,7 +120,7 @@ it('skipfields controls fields included in CSV output', function(done){
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql as csv', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20cartodb_id,ST_AsEWKT(the_geom)%20as%20geom%20FROM%20untitle_table_4%20LIMIT%201' +
|
||||
'&format=csv',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
@ -135,7 +135,7 @@ it('GET /api/v1/sql as csv', function(done){
|
||||
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/60
|
||||
it('GET /api/v1/sql as csv with no rows', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20true%20WHERE%20false&format=csv',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -150,7 +150,7 @@ it('GET /api/v1/sql as csv with no rows', function(done){
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql as csv, properly escaped', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20cartodb_id,%20address%20FROM%20untitle_table_4%20LIMIT%201&format=csv',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -174,7 +174,7 @@ it('GET /api/v1/sql as csv, concurrently', function(done){
|
||||
}
|
||||
}
|
||||
for (var i=0; i<concurrency; ++i) {
|
||||
assert.response(app,
|
||||
assert.response(server,
|
||||
{
|
||||
url: '/api/v1/sql?q=SELECT%20cartodb_id,%20address%20FROM%20untitle_table_4%20LIMIT%201&format=csv',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
@ -191,7 +191,7 @@ it('GET /api/v1/sql as csv, concurrently', function(done){
|
||||
it('expects 1200 rows in public table', function(done){
|
||||
var limit = 1200;
|
||||
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SELECT * from populated_places_simple_reduced limit " + limit,
|
||||
format: 'csv'
|
||||
|
@ -1,12 +1,12 @@
|
||||
require('../../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../../app/server')();
|
||||
var assert = require('../../support/assert');
|
||||
var querystring = require('querystring');
|
||||
|
||||
// allow lots of emitters to be set to silence warning
|
||||
// TODO: check if still needed ...
|
||||
app.setMaxListeners(0);
|
||||
server.setMaxListeners(0);
|
||||
|
||||
// use dec_sep for internationalization
|
||||
var checkDecimals = function(x, dec_sep){
|
||||
@ -23,7 +23,7 @@ describe('export.geojson', function() {
|
||||
// GEOJSON tests
|
||||
|
||||
it('GET /api/v1/sql with SQL parameter, ensuring content-disposition set to geojson', function(done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&format=geojson',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -37,7 +37,7 @@ it('GET /api/v1/sql with SQL parameter, ensuring content-disposition set to geoj
|
||||
});
|
||||
|
||||
it('POST /api/v1/sql with SQL parameter, ensuring content-disposition set to geojson', function(done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: querystring.stringify({q: "SELECT * FROM untitle_table_4", format: 'geojson' }),
|
||||
headers: {host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
@ -52,7 +52,7 @@ it('POST /api/v1/sql with SQL parameter, ensuring content-disposition set to geo
|
||||
});
|
||||
|
||||
it('uses the last format parameter when multiple are used', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?format=csv&q=SELECT%20*%20FROM%20untitle_table_4&format=geojson',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -65,7 +65,7 @@ it('uses the last format parameter when multiple are used', function(done){
|
||||
});
|
||||
|
||||
it('uses custom filename', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&format=geojson&filename=x',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -78,7 +78,7 @@ it('uses custom filename', function(done){
|
||||
});
|
||||
|
||||
it('does not include the_geom and the_geom_webmercator properties by default', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&format=geojson',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -99,7 +99,7 @@ it('does not include the_geom and the_geom_webmercator properties by default', f
|
||||
});
|
||||
|
||||
it('skipfields controls fields included in GeoJSON output', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4&format=geojson&skipfields=unexistant,cartodb_id',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -121,7 +121,7 @@ it('skipfields controls fields included in GeoJSON output', function(done){
|
||||
|
||||
|
||||
it('GET /api/v1/sql as geojson limiting decimal places', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: 'SELECT ST_MakePoint(0.123,2.3456) as the_geom',
|
||||
format: 'geojson',
|
||||
@ -137,7 +137,7 @@ it('GET /api/v1/sql as geojson limiting decimal places', function(done){
|
||||
});
|
||||
|
||||
it('GET /api/v1/sql as geojson with default dp as 6', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: 'SELECT ST_MakePoint(0.12345678,2.3456787654) as the_geom',
|
||||
format: 'geojson'}),
|
||||
@ -152,7 +152,7 @@ it('GET /api/v1/sql as geojson with default dp as 6', function(done){
|
||||
});
|
||||
|
||||
it('null geometries in geojson output', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SELECT 1 as gid, 'U' as name, null::geometry as the_geom ",
|
||||
format: 'geojson'
|
||||
@ -177,7 +177,7 @@ it('null geometries in geojson output', function(done){
|
||||
});
|
||||
|
||||
it('stream response handle errors', function(done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SELECTT 1 as gid, null::geometry as the_geom ",
|
||||
format: 'geojson'
|
||||
@ -195,7 +195,7 @@ it('stream response handle errors', function(done) {
|
||||
});
|
||||
|
||||
it('stream response with empty result set has valid output', function(done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SELECT 1 as gid, null::geometry as the_geom limit 0",
|
||||
format: 'geojson'
|
||||
|
@ -1,6 +1,6 @@
|
||||
require('../../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../../app/server')();
|
||||
var assert = require('../../support/assert');
|
||||
var sqlite = require('sqlite3');
|
||||
var fs = require('fs');
|
||||
@ -11,7 +11,7 @@ describe('geopackage query', function(){
|
||||
var base_url = '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=gpkg&filename=' + table_name;
|
||||
|
||||
it('returns a valid geopackage database', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: base_url,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -30,7 +30,7 @@ describe('geopackage query', function(){
|
||||
});
|
||||
|
||||
it('gets database and geopackage schema', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: base_url,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
|
@ -1,6 +1,6 @@
|
||||
require('../../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../../app/server')();
|
||||
var assert = require('../../support/assert');
|
||||
var querystring = require('querystring');
|
||||
var libxmljs = require('libxmljs');
|
||||
@ -8,7 +8,7 @@ var http = require('http');
|
||||
var server_utils = require('../../support/server_utils');
|
||||
|
||||
// allow lots of emitters to be set to silence warning
|
||||
app.setMaxListeners(0);
|
||||
server.setMaxListeners(0);
|
||||
|
||||
describe('export.kml', function() {
|
||||
|
||||
@ -109,7 +109,7 @@ var extractFolderName = function(kml) {
|
||||
// KML tests
|
||||
|
||||
it('KML format, unauthenticated', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=kml',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -132,7 +132,7 @@ it('KML format, unauthenticated', function(done){
|
||||
});
|
||||
|
||||
it('KML format, unauthenticated, POST', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: 'q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=kml',
|
||||
headers: {host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
@ -147,7 +147,7 @@ it('KML format, unauthenticated, POST', function(done){
|
||||
});
|
||||
|
||||
it('KML format, bigger than 81920 bytes', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: querystring.stringify({
|
||||
q: 'SELECT 0 as fname FROM generate_series(0,81920)',
|
||||
@ -166,7 +166,7 @@ it('KML format, bigger than 81920 bytes', function(done){
|
||||
});
|
||||
|
||||
it('KML format, skipfields', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=kml&skipfields=address,cartodb_id',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -189,7 +189,7 @@ it('KML format, skipfields', function(done){
|
||||
});
|
||||
|
||||
it('KML format, unauthenticated, custom filename', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=kml&filename=kmltest',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -205,7 +205,7 @@ it('KML format, unauthenticated, custom filename', function(done){
|
||||
});
|
||||
|
||||
it('KML format, authenticated', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=kml&api_key=1234',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -243,7 +243,7 @@ it('KML format, unauthenticated, concurrent requests', function(done){
|
||||
assert.equal(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
|
||||
assert.equal(true, /filename=multi.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
|
||||
if ( ! --waiting ) {
|
||||
app.close();
|
||||
server.close();
|
||||
done();
|
||||
}
|
||||
});
|
||||
@ -253,8 +253,8 @@ it('KML format, unauthenticated, concurrent requests', function(done){
|
||||
console.log("Response error" + err);
|
||||
}
|
||||
|
||||
server_utils.startOnNextPort(app, function() {
|
||||
var port = app.address().port;
|
||||
server_utils.startOnNextPort(server, function() {
|
||||
var port = server.address().port;
|
||||
//console.log("Listening on port " + port);
|
||||
for (var i=0; i<concurrency; ++i) {
|
||||
//console.log("Sending request");
|
||||
@ -274,7 +274,7 @@ it('KML format, unauthenticated, concurrent requests', function(done){
|
||||
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/60
|
||||
it('GET /api/v1/sql as kml with no rows', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20true%20WHERE%20false&format=kml',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -294,7 +294,7 @@ it('GET /api/v1/sql as kml with no rows', function(done){
|
||||
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/90
|
||||
it('GET /api/v1/sql as kml with ending semicolon', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: 'SELECT true WHERE false;',
|
||||
format: 'kml'
|
||||
@ -317,7 +317,7 @@ it('GET /api/v1/sql as kml with ending semicolon', function(done){
|
||||
|
||||
// See https://github.com/CartoDB/cartodb/issues/276
|
||||
it('check point coordinates, unauthenticated', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: 'SELECT * from untitle_table_4 WHERE cartodb_id = -1',
|
||||
format: 'kml'
|
||||
@ -335,7 +335,7 @@ it('check point coordinates, unauthenticated', function(done){
|
||||
|
||||
// See https://github.com/CartoDB/cartodb/issues/276
|
||||
it('check point coordinates, authenticated', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: 'SELECT * from untitle_table_4 WHERE cartodb_id = -1',
|
||||
api_key: 1234,
|
||||
@ -357,7 +357,7 @@ it('check point coordinates, authenticated', function(done){
|
||||
|
||||
it('expects ' + limit + ' placemarks in public table', function(done){
|
||||
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: querystring.stringify({
|
||||
q: "SELECT * from populated_places_simple_reduced limit " + limit,
|
||||
@ -378,7 +378,7 @@ it('check point coordinates, authenticated', function(done){
|
||||
|
||||
it('expects ' + limit + ' placemarks in private table using the API KEY', function(done){
|
||||
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SELECT * from populated_places_simple_reduced limit " + limit,
|
||||
api_key: 1234,
|
||||
@ -399,7 +399,7 @@ it('check point coordinates, authenticated', function(done){
|
||||
|
||||
it('should work with queries returning no results', function(done) {
|
||||
assert.response(
|
||||
app,
|
||||
server,
|
||||
{
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: "SELECT * FROM populated_places_simple_reduced LIMIT 0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
require('../../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../../app/server')();
|
||||
var assert = require('../../support/assert');
|
||||
var querystring = require('querystring');
|
||||
var shapefile = require('shapefile');
|
||||
@ -9,14 +9,14 @@ var zipfile = require('zipfile');
|
||||
var fs = require('fs');
|
||||
|
||||
// allow lots of emitters to be set to silence warning
|
||||
app.setMaxListeners(0);
|
||||
server.setMaxListeners(0);
|
||||
|
||||
describe('export.shapefile', function() {
|
||||
|
||||
// SHP tests
|
||||
|
||||
it('SHP format, unauthenticated', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=shp',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
@ -43,7 +43,7 @@ it('SHP format, unauthenticated', function(done){
|
||||
});
|
||||
|
||||
it('SHP format, unauthenticated, POST', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: 'q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=shp',
|
||||
headers: {host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
@ -58,7 +58,7 @@ it('SHP format, unauthenticated, POST', function(done){
|
||||
});
|
||||
|
||||
it('SHP format, big size, POST', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: querystring.stringify({
|
||||
q: 'SELECT 0 as fname, st_makepoint(i,i) FROM generate_series(0,81920) i',
|
||||
@ -77,7 +77,7 @@ it('SHP format, big size, POST', function(done){
|
||||
});
|
||||
|
||||
it('SHP format, unauthenticated, with custom filename', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=shp&filename=myshape',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
@ -103,7 +103,7 @@ it('SHP format, unauthenticated, with custom filename', function(done){
|
||||
});
|
||||
|
||||
it('SHP format, unauthenticated, with custom, dangerous filename', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=shp&filename=b;"%20()[]a',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
@ -130,7 +130,7 @@ it('SHP format, unauthenticated, with custom, dangerous filename', function(done
|
||||
});
|
||||
|
||||
it('SHP format, authenticated', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=shp&api_key=1234',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
@ -163,7 +163,7 @@ it('SHP format, unauthenticated, with utf8 data', function(done){
|
||||
format: 'shp',
|
||||
filename: 'myshape'
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
@ -190,7 +190,7 @@ it('mixed type geometry', function(done){
|
||||
q: "SELECT 'POINT(0 0)'::geometry as g UNION ALL SELECT 'LINESTRING(0 0, 1 0)'::geometry",
|
||||
format: 'shp'
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
@ -215,7 +215,7 @@ it('errors are not confused with warnings', function(done){
|
||||
].join(" UNION ALL "),
|
||||
format: 'shp'
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
@ -238,7 +238,7 @@ it('skipfields controls fields included in SHP output', function(done){
|
||||
skipfields: 'skipme',
|
||||
filename: 'myshape'
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
@ -284,7 +284,7 @@ it('SHP format, concurrently', function(done){
|
||||
}
|
||||
for (var i=0; i<concurrency; ++i) {
|
||||
assert.response(
|
||||
app,
|
||||
server,
|
||||
{
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=shp',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
@ -305,7 +305,7 @@ it('point with null first', function(done){
|
||||
q: "SELECT null::geometry as g UNION ALL SELECT 'SRID=4326;POINT(0 0)'::geometry",
|
||||
format: 'shp'
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
encoding: 'binary',
|
||||
@ -336,7 +336,7 @@ it('point with null first', function(done){
|
||||
|
||||
var filename = 'test_1200';
|
||||
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: "SELECT * from populated_places_simple_reduced limit " + limit,
|
||||
format: 'shp',
|
||||
|
@ -1,13 +1,13 @@
|
||||
require('../../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../../app/server')();
|
||||
var assert = require('../../support/assert');
|
||||
var sqlite = require('sqlite3');
|
||||
|
||||
describe('spatialite query', function(){
|
||||
|
||||
it('returns a valid sqlite database', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=spatialite',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -25,7 +25,7 @@ describe('spatialite query', function(){
|
||||
});
|
||||
|
||||
it('different file name', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=spatialite&filename=manolo',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -37,7 +37,7 @@ describe('spatialite query', function(){
|
||||
});
|
||||
|
||||
it('gets database schema', function(done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT%20*%20FROM%20untitle_table_4%20LIMIT%201&format=spatialite',
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
|
@ -1,11 +1,11 @@
|
||||
require('../../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../../app/server')();
|
||||
var assert = require('../../support/assert');
|
||||
var querystring = require('querystring');
|
||||
|
||||
// allow lots of emitters to be set to silence warning
|
||||
app.setMaxListeners(0);
|
||||
server.setMaxListeners(0);
|
||||
|
||||
describe('export.svg', function() {
|
||||
|
||||
@ -14,7 +14,7 @@ it('GET /api/v1/sql with SVG format', function(done){
|
||||
q: "SELECT 1 as cartodb_id, ST_MakeLine(ST_MakePoint(10, 10), ST_MakePoint(1034, 778)) AS the_geom ",
|
||||
format: "svg"
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -34,7 +34,7 @@ it('POST /api/v1/sql with SVG format', function(done){
|
||||
q: "SELECT 1 as cartodb_id, ST_MakeLine(ST_MakePoint(10, 10), ST_MakePoint(1034, 778)) AS the_geom ",
|
||||
format: "svg"
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql',
|
||||
data: query,
|
||||
headers: {host: 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
@ -57,7 +57,7 @@ it('GET /api/v1/sql with SVG format and custom filename', function(done){
|
||||
format: "svg",
|
||||
filename: 'mysvg'
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -77,7 +77,7 @@ it('GET /api/v1/sql with SVG format and centered point', function(done){
|
||||
q: "SELECT 1 as cartodb_id, ST_MakePoint(5000, -54) AS the_geom ",
|
||||
format: "svg"
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -99,7 +99,7 @@ it('GET /api/v1/sql with SVG format and trimmed decimals', function(done){
|
||||
format: "svg",
|
||||
dp: 2
|
||||
};
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify(queryobj),
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -112,7 +112,7 @@ it('GET /api/v1/sql with SVG format and trimmed decimals', function(done){
|
||||
// TODO: test viewBox
|
||||
|
||||
queryobj.dp = 3;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + querystring.stringify(queryobj),
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -137,7 +137,7 @@ it('SVG format with "the_geom" in skipfields', function(done){
|
||||
format: "svg",
|
||||
skipfields: "the_geom"
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -157,7 +157,7 @@ it('SVG format with missing "the_geom" field', function(done){
|
||||
q: "SELECT 1 as cartodb_id, ST_MakePoint(5000, -54) AS something_else ",
|
||||
format: "svg"
|
||||
});
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
@ -172,7 +172,7 @@ it('SVG format with missing "the_geom" field', function(done){
|
||||
|
||||
it('should close on error and error must be the only key in the body', function(done) {
|
||||
assert.response(
|
||||
app,
|
||||
server,
|
||||
{
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: "SELECT the_geom, 100/(cartodb_id - 3) cdb_ratio FROM untitle_table_4",
|
||||
|
@ -1,12 +1,12 @@
|
||||
require('../../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../../app/server')();
|
||||
var assert = require('../../support/assert');
|
||||
var querystring = require('querystring');
|
||||
var _ = require('underscore');
|
||||
|
||||
// allow lots of emitters to be set to silence warning
|
||||
app.setMaxListeners(0);
|
||||
server.setMaxListeners(0);
|
||||
|
||||
|
||||
describe('export.topojson', function() {
|
||||
@ -29,7 +29,7 @@ describe('export.topojson', function() {
|
||||
}
|
||||
|
||||
it('GET two polygons sharing an edge as topojson', function(done){
|
||||
assert.response(app,
|
||||
assert.response(server,
|
||||
getRequest(
|
||||
"SELECT 1 as gid, 'U' as name, 'POLYGON((-5 0,5 0,0 5,-5 0))'::geometry as the_geom " +
|
||||
" UNION ALL " +
|
||||
@ -135,7 +135,7 @@ it('GET two polygons sharing an edge as topojson', function(done){
|
||||
});
|
||||
|
||||
it('null geometries', function(done){
|
||||
assert.response(app, getRequest(
|
||||
assert.response(server, getRequest(
|
||||
"SELECT 1 as gid, 'U' as name, 'POLYGON((-5 0,5 0,0 5,-5 0))'::geometry as the_geom " +
|
||||
" UNION ALL " +
|
||||
"SELECT 2, 'D', null::geometry as the_geom "
|
||||
@ -193,7 +193,7 @@ it('null geometries', function(done){
|
||||
});
|
||||
|
||||
it('skipped fields are not returned', function(done) {
|
||||
assert.response(app,
|
||||
assert.response(server,
|
||||
getRequest(
|
||||
"SELECT 1 as gid, 'U' as name, 'POLYGON((-5 0,5 0,0 5,-5 0))'::geometry as the_geom",
|
||||
{
|
||||
@ -214,7 +214,7 @@ it('null geometries', function(done){
|
||||
|
||||
it('jsonp callback is invoked', function(done){
|
||||
assert.response(
|
||||
app,
|
||||
server,
|
||||
getRequest(
|
||||
"SELECT 1 as gid, 'U' as name, 'POLYGON((-5 0,5 0,0 5,-5 0))'::geometry as the_geom",
|
||||
{
|
||||
@ -242,7 +242,7 @@ it('null geometries', function(done){
|
||||
|
||||
it('should close on error and error must be the only key in the body', function(done) {
|
||||
assert.response(
|
||||
app,
|
||||
server,
|
||||
{
|
||||
url: "/api/v1/sql?" + querystring.stringify({
|
||||
q: "SELECT the_geom, 100/(cartodb_id - 3) cdb_ratio FROM untitle_table_4",
|
||||
|
@ -30,12 +30,12 @@ it('aborts request', function(done){
|
||||
var db_port_backup = global.settings.db_port;
|
||||
global.settings.db_host = 'localhost';
|
||||
global.settings.db_port = sql_server_port;
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var timeout;
|
||||
step(
|
||||
function sendQuery() {
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT+1',
|
||||
method: 'GET',
|
||||
timeout: 1,
|
||||
|
@ -2,7 +2,7 @@ require('../helper');
|
||||
require('../support/assert');
|
||||
|
||||
var assert = require('assert');
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
|
||||
describe('health checks', function() {
|
||||
|
||||
@ -26,7 +26,7 @@ describe('health checks', function() {
|
||||
it('returns 200 and ok=true with disabled configuration', function(done) {
|
||||
global.settings.health.enabled = false;
|
||||
|
||||
assert.response(app,
|
||||
assert.response(server,
|
||||
healthCheckRequest,
|
||||
{
|
||||
status: 200
|
||||
@ -45,7 +45,7 @@ describe('health checks', function() {
|
||||
});
|
||||
|
||||
it('returns 200 and ok=true with enabled configuration', function(done) {
|
||||
assert.response(app,
|
||||
assert.response(server,
|
||||
healthCheckRequest,
|
||||
{
|
||||
status: 200
|
||||
|
@ -2,7 +2,7 @@ require('../helper');
|
||||
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var querystring = require('qs');
|
||||
var redisConfig = {
|
||||
host: global.settings.redis_host,
|
||||
@ -18,7 +18,7 @@ var jobStatus = require('../../batch/job_status');
|
||||
describe('Batch API callback templates', function () {
|
||||
|
||||
function createJob(jobDefinition, callback) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -37,7 +37,7 @@ describe('Batch API callback templates', function () {
|
||||
}
|
||||
|
||||
function getJobStatus(jobId, callback) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + jobId + '?api_key=1234&',
|
||||
headers: {
|
||||
host: 'vizzuality.cartodb.com'
|
||||
@ -54,7 +54,7 @@ describe('Batch API callback templates', function () {
|
||||
}
|
||||
|
||||
function getQueryResult(query, callback) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql?' + querystring.stringify({q: query, api_key: 1234}),
|
||||
headers: {
|
||||
host: 'vizzuality.cartodb.com'
|
||||
|
@ -2,7 +2,7 @@ require('../helper');
|
||||
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var querystring = require('qs');
|
||||
var redisConfig = {
|
||||
host: global.settings.redis_host,
|
||||
@ -52,7 +52,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -89,7 +89,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -120,7 +120,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -156,7 +156,7 @@ describe('Batch API fallback job', function () {
|
||||
}]
|
||||
};
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -187,7 +187,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -224,7 +224,7 @@ describe('Batch API fallback job', function () {
|
||||
}]
|
||||
};
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -255,7 +255,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -293,7 +293,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -325,7 +325,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -361,7 +361,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -392,7 +392,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -429,7 +429,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -461,7 +461,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -498,7 +498,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -529,7 +529,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -565,7 +565,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -597,7 +597,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -636,7 +636,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -667,7 +667,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -712,7 +712,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -743,7 +743,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -789,7 +789,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -821,7 +821,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -867,7 +867,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -898,7 +898,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -943,7 +943,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -974,7 +974,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1012,7 +1012,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1044,7 +1044,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1081,7 +1081,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1112,7 +1112,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1158,7 +1158,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1189,7 +1189,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1235,7 +1235,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1266,7 +1266,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1313,7 +1313,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1345,7 +1345,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1393,7 +1393,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1425,7 +1425,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1464,7 +1464,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1503,7 +1503,7 @@ describe('Batch API fallback job', function () {
|
||||
"onsuccess": "SELECT pg_sleep(0)"
|
||||
};
|
||||
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1531,7 +1531,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1570,7 +1570,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1612,7 +1612,7 @@ describe('Batch API fallback job', function () {
|
||||
"onsuccess": "SELECT pg_sleep(0)"
|
||||
};
|
||||
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1640,7 +1640,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1688,7 +1688,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1719,7 +1719,7 @@ describe('Batch API fallback job', function () {
|
||||
var fallbackJob = {};
|
||||
|
||||
it('should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -1770,7 +1770,7 @@ describe('Batch API fallback job', function () {
|
||||
};
|
||||
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + fallbackJob.job_id + '?api_key=1234&',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
|
@ -15,7 +15,7 @@
|
||||
require('../helper');
|
||||
var JobController = require('../../app/controllers/job_controller');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var querystring = require('qs');
|
||||
|
||||
@ -42,7 +42,7 @@ describe('job query limit', function() {
|
||||
|
||||
it('POST /api/v2/sql/job with a invalid query size should respond with 400 query too long', function (done){
|
||||
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -60,7 +60,7 @@ describe('job query limit', function() {
|
||||
|
||||
it('POST /api/v2/sql/job with a valid query size should respond with 201 created', function (done){
|
||||
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -78,7 +78,7 @@ describe('job query limit', function() {
|
||||
|
||||
it('POST /api/v2/sql/job with a invalid query size should consider multiple queries', function (done){
|
||||
var queries = [queryTooLong, 'select 1'];
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -104,7 +104,7 @@ describe('job query limit', function() {
|
||||
onsuccess: "SELECT * FROM untitle_table_4 limit 3"
|
||||
}]
|
||||
};
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -27,7 +27,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('POST /api/v2/sql/job should respond with 200 and the created job', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -48,7 +48,7 @@ describe('job module', function() {
|
||||
|
||||
it('POST /api/v2/sql/job without query should respond with 400 and the corresponding message of error',
|
||||
function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -63,7 +63,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('POST /api/v2/sql/job with bad query param should respond with 400 and message of error', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -80,7 +80,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('POST /api/v2/sql/job with wrong api key should respond with 401 permission denied', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=wrong',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -97,7 +97,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('POST /api/v2/sql/job with wrong host header should respond with 404 not found', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=wrong',
|
||||
headers: { 'host': 'wrong-host.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -119,7 +119,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('GET /api/v2/sql/job/:job_id should respond with 200 and the requested job', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + job.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -135,7 +135,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('GET /api/v2/sql/job/:job_id with wrong api key should respond with 401 permission denied', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + job.job_id + '?api_key=wrong',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -149,7 +149,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('GET /api/v2/sql/job/:jobId with wrong jobId header respond with 400 and an error', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/irrelevantJob?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -166,7 +166,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('DELETE /api/v2/sql/job/:job_id should respond with 200 and the requested job', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + job.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
@ -184,7 +184,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('DELETE /api/v2/sql/job/:job_id with wrong api key should respond with 401 permission denied', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + job.job_id + '?api_key=wrong',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
@ -198,7 +198,7 @@ describe('job module', function() {
|
||||
});
|
||||
|
||||
it('DELETE /api/v2/sql/job/ with wrong host header respond with 404 not found', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + job.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'wrong-host.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -2,7 +2,7 @@ require('../helper');
|
||||
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var querystring = require('qs');
|
||||
var redisConfig = {
|
||||
host: global.settings.redis_host,
|
||||
@ -18,7 +18,7 @@ var jobStatus = require('../../batch/job_status');
|
||||
describe('Batch API query timing', function () {
|
||||
|
||||
function createJob(jobDefinition, callback) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@ -37,7 +37,7 @@ describe('Batch API query timing', function () {
|
||||
}
|
||||
|
||||
function getJobStatus(jobId, callback) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + jobId + '?api_key=1234&',
|
||||
headers: {
|
||||
host: 'vizzuality.cartodb.com'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -44,7 +44,7 @@ describe('Use case 1: cancel and modify a done job', function () {
|
||||
var doneJob = {};
|
||||
|
||||
it('Step 1, should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -61,7 +61,7 @@ describe('Use case 1: cancel and modify a done job', function () {
|
||||
|
||||
it('Step 2, job should be done', function (done) {
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + doneJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -83,7 +83,7 @@ describe('Use case 1: cancel and modify a done job', function () {
|
||||
});
|
||||
|
||||
it('Step 3, cancel a done job should give an error', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + doneJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -44,7 +44,7 @@ describe('Use case 10: cancel and modify a done multiquery job', function () {
|
||||
var doneJob = {};
|
||||
|
||||
it('Step 1, should create a multiquery job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -65,7 +65,7 @@ describe('Use case 10: cancel and modify a done multiquery job', function () {
|
||||
|
||||
it('Step 2, multiquery job should be done', function (done) {
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + doneJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -87,7 +87,7 @@ describe('Use case 10: cancel and modify a done multiquery job', function () {
|
||||
});
|
||||
|
||||
it('Step 3, cancel a done multiquery job should give an error', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + doneJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -45,7 +45,7 @@ describe('Use case 2: cancel a running job', function() {
|
||||
var cancelledJob = {};
|
||||
|
||||
it('Step 1, should create a new job', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -62,7 +62,7 @@ describe('Use case 2: cancel a running job', function() {
|
||||
|
||||
it('Step 2, job should be running', function (done){
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -82,7 +82,7 @@ describe('Use case 2: cancel a running job', function() {
|
||||
});
|
||||
|
||||
it('Step 3, cancel a job', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
@ -96,7 +96,7 @@ describe('Use case 2: cancel a running job', function() {
|
||||
});
|
||||
|
||||
it('Step 4, job should be cancelled', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -113,7 +113,7 @@ describe('Use case 2: cancel a running job', function() {
|
||||
});
|
||||
|
||||
it('Step 5, cancel a cancelled should give an error', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + cancelledJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -45,7 +45,7 @@ describe('Use case 3: cancel a pending job', function() {
|
||||
var pendingJob = {};
|
||||
|
||||
it('Step 1, should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -61,7 +61,7 @@ describe('Use case 3: cancel a pending job', function() {
|
||||
});
|
||||
|
||||
it('Step 2, should create a another job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -78,7 +78,7 @@ describe('Use case 3: cancel a pending job', function() {
|
||||
|
||||
it('Step 3, job should be pending', function (done){
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + pendingJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -98,7 +98,7 @@ describe('Use case 3: cancel a pending job', function() {
|
||||
});
|
||||
|
||||
it('Step 4, cancel a pending job should be cancelled', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + pendingJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
@ -113,7 +113,7 @@ describe('Use case 3: cancel a pending job', function() {
|
||||
});
|
||||
|
||||
it('Step 5, running job should be cancelled', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -45,7 +45,7 @@ describe('Use case 4: modify a pending job', function() {
|
||||
var pendingJob = {};
|
||||
|
||||
it('Step 1, should create a job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -61,7 +61,7 @@ describe('Use case 4: modify a pending job', function() {
|
||||
});
|
||||
|
||||
it('Step 2, should create another job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -78,7 +78,7 @@ describe('Use case 4: modify a pending job', function() {
|
||||
|
||||
it('Step 3, job should be pending', function (done){
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + pendingJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -98,7 +98,7 @@ describe('Use case 4: modify a pending job', function() {
|
||||
});
|
||||
|
||||
it('Step 5, running job should be cancelled', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -44,7 +44,7 @@ describe('Use case 5: modify a running job', function() {
|
||||
var runningJob = {};
|
||||
|
||||
it('Step 1, should create job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -61,7 +61,7 @@ describe('Use case 5: modify a running job', function() {
|
||||
|
||||
it('Step 2, job should be running', function (done){
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -81,7 +81,7 @@ describe('Use case 5: modify a running job', function() {
|
||||
});
|
||||
|
||||
it('Step 4, running job should be cancelled', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -44,7 +44,7 @@ describe('Use case 6: modify a done job', function() {
|
||||
var doneJob = {};
|
||||
|
||||
it('Step 1, should create job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -61,7 +61,7 @@ describe('Use case 6: modify a done job', function() {
|
||||
|
||||
it('Step 2, job should be done', function (done) {
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + doneJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -44,7 +44,7 @@ describe('Use case 7: cancel a job with quotes', function() {
|
||||
var runningJob = {};
|
||||
|
||||
it('Step 1, should create job with quotes', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -61,7 +61,7 @@ describe('Use case 7: cancel a job with quotes', function() {
|
||||
|
||||
it('Step 2, job should be running', function (done){
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -81,7 +81,7 @@ describe('Use case 7: cancel a job with quotes', function() {
|
||||
});
|
||||
|
||||
it('Step 3, running job should be cancelled', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -45,7 +45,7 @@ describe('Use case 8: cancel a running multiquery job', function() {
|
||||
var cancelledJob = {};
|
||||
|
||||
it('Step 1, should create a new multiquery job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -66,7 +66,7 @@ describe('Use case 8: cancel a running multiquery job', function() {
|
||||
|
||||
it('Step 2, multiquery job should be running', function (done){
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -86,7 +86,7 @@ describe('Use case 8: cancel a running multiquery job', function() {
|
||||
});
|
||||
|
||||
it('Step 3, cancel a multiquery job', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
@ -100,7 +100,7 @@ describe('Use case 8: cancel a running multiquery job', function() {
|
||||
});
|
||||
|
||||
it('Step 4, multiquery job should be cancelled', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -117,7 +117,7 @@ describe('Use case 8: cancel a running multiquery job', function() {
|
||||
});
|
||||
|
||||
it('Step 5, cancel a cancelled multiquery job should give an error', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + cancelledJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var redisUtils = require('../support/redis_utils');
|
||||
var querystring = require('querystring');
|
||||
@ -45,7 +45,7 @@ describe('Use case 9: modify a pending multiquery job', function() {
|
||||
var pendingJob = {};
|
||||
|
||||
it('Step 1, should create a multiquery job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -64,7 +64,7 @@ describe('Use case 9: modify a pending multiquery job', function() {
|
||||
});
|
||||
|
||||
it('Step 2, should create another multiquery job', function (done) {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
@ -84,7 +84,7 @@ describe('Use case 9: modify a pending multiquery job', function() {
|
||||
|
||||
it('Step 3, multiquery job should be pending', function (done){
|
||||
var interval = setInterval(function () {
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + pendingJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'GET'
|
||||
@ -104,7 +104,7 @@ describe('Use case 9: modify a pending multiquery job', function() {
|
||||
});
|
||||
|
||||
it('Step 5, running multiquery job should be cancelled', function (done){
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v2/sql/job/' + runningJob.job_id + '?api_key=1234',
|
||||
headers: { 'host': 'vizzuality.cartodb.com', 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
method: 'DELETE'
|
||||
|
@ -1,6 +1,6 @@
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var qs = require('querystring');
|
||||
|
||||
@ -37,7 +37,7 @@ describe('last modified header', function() {
|
||||
}).join(' UNION ALL '),
|
||||
api_key: 1234
|
||||
});
|
||||
assert.response(app,
|
||||
assert.response(server,
|
||||
{
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {
|
||||
@ -66,7 +66,7 @@ describe('last modified header', function() {
|
||||
Date.now = function() {
|
||||
return fixedDateNow;
|
||||
};
|
||||
assert.response(app,
|
||||
assert.response(server,
|
||||
{
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {
|
||||
@ -95,7 +95,7 @@ describe('last modified header', function() {
|
||||
Date.now = function() {
|
||||
return fixedDateNow;
|
||||
};
|
||||
assert.response(app,
|
||||
assert.response(server,
|
||||
{
|
||||
url: '/api/v1/sql?' + query,
|
||||
headers: {
|
||||
|
@ -1,6 +1,6 @@
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app');
|
||||
var appServer = require('../../app/server');
|
||||
var assert = require('../support/assert');
|
||||
var qs = require('querystring');
|
||||
var log4js = require('log4js');
|
||||
@ -32,7 +32,7 @@ describe('Logging SQL query on POST requests', function() {
|
||||
}
|
||||
]
|
||||
});
|
||||
server = app();
|
||||
server = appServer();
|
||||
});
|
||||
|
||||
after(function() {
|
||||
|
@ -2,14 +2,14 @@ require('../helper');
|
||||
|
||||
var qs = require('querystring');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
|
||||
describe('query-tables-api', function() {
|
||||
|
||||
function getCacheStatus(callback) {
|
||||
assert.response(
|
||||
app,
|
||||
server,
|
||||
{
|
||||
method: 'GET',
|
||||
url: '/api/v1/cachestatus'
|
||||
@ -38,7 +38,7 @@ describe('query-tables-api', function() {
|
||||
};
|
||||
|
||||
it('should create a key in affected tables cache', function(done) {
|
||||
assert.response(app, request, RESPONSE_OK, function(res, err) {
|
||||
assert.response(server, request, RESPONSE_OK, function(res, err) {
|
||||
assert.ok(!err, err);
|
||||
|
||||
getCacheStatus(function(err, cacheStatus) {
|
||||
@ -52,7 +52,7 @@ describe('query-tables-api', function() {
|
||||
});
|
||||
|
||||
it('should use cache to retrieve affected tables', function(done) {
|
||||
assert.response(app, request, RESPONSE_OK, function(res, err) {
|
||||
assert.response(server, request, RESPONSE_OK, function(res, err) {
|
||||
assert.ok(!err, err);
|
||||
|
||||
getCacheStatus(function(err, cacheStatus) {
|
||||
@ -76,7 +76,7 @@ describe('query-tables-api', function() {
|
||||
},
|
||||
method: 'GET'
|
||||
};
|
||||
assert.response(app, authenticatedRequest, RESPONSE_OK, function(res, err) {
|
||||
assert.response(server, authenticatedRequest, RESPONSE_OK, function(res, err) {
|
||||
assert.ok(!err, err);
|
||||
|
||||
getCacheStatus(function(err, cacheStatus) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var qs = require('querystring');
|
||||
|
||||
@ -25,13 +25,13 @@ describe('regressions', function() {
|
||||
statusCode: 200
|
||||
};
|
||||
|
||||
assert.response(app, createRequest('CREATE TABLE "foo.bar" (a int);'), responseOk,
|
||||
assert.response(server, createRequest('CREATE TABLE "foo.bar" (a int);'), responseOk,
|
||||
function(res, err) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
assert.response(app, createRequest('INSERT INTO "foo.bar" (a) values (1), (2)'), responseOk,
|
||||
assert.response(server, createRequest('INSERT INTO "foo.bar" (a) values (1), (2)'), responseOk,
|
||||
function(res, err) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -39,7 +39,7 @@ describe('regressions', function() {
|
||||
var parsedBody = JSON.parse(res.body);
|
||||
assert.equal(parsedBody.total_rows, 2);
|
||||
|
||||
assert.response(app, createRequest('SELECT * FROM "foo.bar"'), responseOk,
|
||||
assert.response(server, createRequest('SELECT * FROM "foo.bar"'), responseOk,
|
||||
function(res, err) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
|
@ -1,6 +1,6 @@
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var querystring = require('querystring');
|
||||
|
||||
@ -32,7 +32,7 @@ describe('stream-responses', function() {
|
||||
|
||||
it('should close on error and error message must be part of the response', function(done) {
|
||||
assert.response(
|
||||
app,
|
||||
server,
|
||||
createFailingQueryRequest(),
|
||||
okResponse,
|
||||
function(res) {
|
||||
@ -54,7 +54,7 @@ describe('stream-responses', function() {
|
||||
|
||||
it('should close on error and error message must be part of the response', function(done) {
|
||||
assert.response(
|
||||
app,
|
||||
server,
|
||||
createFailingQueryRequest('geojson'),
|
||||
okResponse,
|
||||
function(res) {
|
||||
|
@ -1,13 +1,13 @@
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var querystring = require('querystring');
|
||||
var QueryTables = require('cartodb-query-tables');
|
||||
var _ = require('underscore');
|
||||
|
||||
// allow lots of emitters to be set to silence warning
|
||||
app.setMaxListeners(0);
|
||||
server.setMaxListeners(0);
|
||||
|
||||
describe('Surrogate-Key header', function() {
|
||||
|
||||
@ -53,7 +53,7 @@ describe('Surrogate-Key header', function() {
|
||||
var sql = "SELECT a.name as an, b.name as bn FROM untitle_table_4 a " +
|
||||
"left join private_table b ON (a.cartodb_id = b.cartodb_id)";
|
||||
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, tableNamesInSurrogateKeyHeader([
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, tableNamesInSurrogateKeyHeader([
|
||||
{dbname: 'cartodb_test_user_1_db', schema_name: 'public', table_name: 'private_table'},
|
||||
{dbname: 'cartodb_test_user_1_db', schema_name: 'public', table_name: 'untitle_table_4'}
|
||||
], done));
|
||||
@ -62,7 +62,7 @@ describe('Surrogate-Key header', function() {
|
||||
it('supports multistatements', function(done) {
|
||||
var sql = "SELECT * FROM untitle_table_4; SELECT * FROM private_table";
|
||||
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, tableNamesInSurrogateKeyHeader([
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, tableNamesInSurrogateKeyHeader([
|
||||
{dbname: 'cartodb_test_user_1_db', schema_name: 'public', table_name: 'private_table'},
|
||||
{dbname: 'cartodb_test_user_1_db', schema_name: 'public', table_name: 'untitle_table_4'}
|
||||
], done));
|
||||
@ -71,7 +71,7 @@ describe('Surrogate-Key header', function() {
|
||||
it('supports explicit transactions', function(done) {
|
||||
var sql = "BEGIN; SELECT * FROM untitle_table_4; COMMIT; BEGIN; SELECT * FROM private_table; COMMIT;";
|
||||
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, tableNamesInSurrogateKeyHeader([
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, tableNamesInSurrogateKeyHeader([
|
||||
{dbname: 'cartodb_test_user_1_db', schema_name: 'public', table_name: 'private_table'},
|
||||
{dbname: 'cartodb_test_user_1_db', schema_name: 'public', table_name: 'untitle_table_4'}
|
||||
], done));
|
||||
@ -80,14 +80,14 @@ describe('Surrogate-Key header', function() {
|
||||
it('survives partial transactions', function(done) {
|
||||
var sql = "BEGIN; SELECT * FROM untitle_table_4";
|
||||
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, tableNamesInSurrogateKeyHeader([
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, tableNamesInSurrogateKeyHeader([
|
||||
{dbname: 'cartodb_test_user_1_db', schema_name: 'public', table_name: 'untitle_table_4'}
|
||||
], done));
|
||||
});
|
||||
|
||||
it('should not add header for functions', function(done) {
|
||||
var sql = "SELECT format('%s', 'wadus')";
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.ok(!res.headers.hasOwnProperty('surrogate-key'), res.headers['surrogate-key']);
|
||||
done();
|
||||
});
|
||||
@ -95,7 +95,7 @@ describe('Surrogate-Key header', function() {
|
||||
|
||||
it('should not add header for CDB_QueryTables', function(done) {
|
||||
var sql = "SELECT CDB_QueryTablesText('select * from untitle_table_4')";
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.ok(!res.headers.hasOwnProperty('surrogate-key'), res.headers['surrogate-key']);
|
||||
done();
|
||||
});
|
||||
@ -103,7 +103,7 @@ describe('Surrogate-Key header', function() {
|
||||
|
||||
it('should not add header for non table results', function(done) {
|
||||
var sql = "SELECT 'wadus'::text";
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.ok(!res.headers.hasOwnProperty('surrogate-key'), res.headers['surrogate-key']);
|
||||
done();
|
||||
});
|
||||
|
@ -26,11 +26,11 @@ it('after configured milliseconds', function(done){
|
||||
//console.log("settings:"); console.dir(global.settings);
|
||||
var timeoutBackup = global.settings.node_socket_timeout;
|
||||
global.settings.node_socket_timeout = testTimeout;
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
step(
|
||||
function sendLongQuery() {
|
||||
var next = this;
|
||||
assert.response(app, {
|
||||
assert.response(server, {
|
||||
url: '/api/v1/sql?q=SELECT+count(*)+FROM+generate_series(1,100000)',
|
||||
method: 'GET',
|
||||
headers: {host: 'vizzuality.localhost' }
|
||||
|
@ -10,7 +10,7 @@ describe('transaction', function() {
|
||||
|
||||
var server;
|
||||
before(function(done) {
|
||||
server = require(global.settings.app_root + '/app/app')();
|
||||
server = require('../../app/server')();
|
||||
server.listen(SERVER_PORT, '127.0.0.1', done);
|
||||
});
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
require('../helper');
|
||||
|
||||
var app = require(global.settings.app_root + '/app/app')();
|
||||
var server = require('../../app/server')();
|
||||
var assert = require('../support/assert');
|
||||
var querystring = require('querystring');
|
||||
var _ = require('underscore');
|
||||
|
||||
// allow lots of emitters to be set to silence warning
|
||||
app.setMaxListeners(0);
|
||||
server.setMaxListeners(0);
|
||||
|
||||
describe('X-Cache-Channel header', function() {
|
||||
|
||||
@ -52,7 +52,7 @@ describe('X-Cache-Channel header', function() {
|
||||
var sql = "SELECT a.name as an, b.name as bn FROM untitle_table_4 a " +
|
||||
"left join private_table b ON (a.cartodb_id = b.cartodb_id)";
|
||||
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, tableNamesInCacheChannelHeader([
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, tableNamesInCacheChannelHeader([
|
||||
'public.private_table',
|
||||
'public.untitle_table_4'
|
||||
], done));
|
||||
@ -61,7 +61,7 @@ describe('X-Cache-Channel header', function() {
|
||||
it('supports multistatements', function(done) {
|
||||
var sql = "SELECT * FROM untitle_table_4; SELECT * FROM private_table";
|
||||
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, tableNamesInCacheChannelHeader([
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, tableNamesInCacheChannelHeader([
|
||||
'public.private_table',
|
||||
'public.untitle_table_4'
|
||||
], done));
|
||||
@ -70,7 +70,7 @@ describe('X-Cache-Channel header', function() {
|
||||
it('supports explicit transactions', function(done) {
|
||||
var sql = "BEGIN; SELECT * FROM untitle_table_4; COMMIT; BEGIN; SELECT * FROM private_table; COMMIT;";
|
||||
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, tableNamesInCacheChannelHeader([
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, tableNamesInCacheChannelHeader([
|
||||
'public.private_table',
|
||||
'public.untitle_table_4'
|
||||
], done));
|
||||
@ -79,14 +79,14 @@ describe('X-Cache-Channel header', function() {
|
||||
it('survives partial transactions', function(done) {
|
||||
var sql = "BEGIN; SELECT * FROM untitle_table_4";
|
||||
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, tableNamesInCacheChannelHeader([
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, tableNamesInCacheChannelHeader([
|
||||
'public.untitle_table_4'
|
||||
], done));
|
||||
});
|
||||
|
||||
it('should not add header for functions', function(done) {
|
||||
var sql = "SELECT format('%s', 'wadus')";
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'), res.headers['x-cache-channel']);
|
||||
done();
|
||||
});
|
||||
@ -94,7 +94,7 @@ describe('X-Cache-Channel header', function() {
|
||||
|
||||
it('should not add header for CDB_QueryTables', function(done) {
|
||||
var sql = "SELECT CDB_QueryTablesText('select * from untitle_table_4')";
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'), res.headers['x-cache-channel']);
|
||||
done();
|
||||
});
|
||||
@ -102,7 +102,7 @@ describe('X-Cache-Channel header', function() {
|
||||
|
||||
it('should not add header for non table results', function(done) {
|
||||
var sql = "SELECT 'wadus'::text";
|
||||
assert.response(app, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.response(server, createGetRequest(sql), RESPONSE_OK, function(res) {
|
||||
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'), res.headers['x-cache-channel']);
|
||||
done();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user