2018-10-24 21:42:33 +08:00
|
|
|
'use strict';
|
|
|
|
|
2018-08-30 18:50:50 +08:00
|
|
|
require('../../helper');
|
|
|
|
require('../../support/assert');
|
|
|
|
|
2018-08-30 21:10:43 +08:00
|
|
|
const fs = require('fs');
|
2019-10-04 00:24:39 +08:00
|
|
|
let server = require('../../../lib/server');
|
2018-08-30 18:50:50 +08:00
|
|
|
const assert = require('assert');
|
|
|
|
const querystring = require('querystring');
|
|
|
|
|
2019-12-24 01:19:08 +08:00
|
|
|
describe('export folder', function () {
|
|
|
|
it('folder exists', function (done) {
|
2018-08-30 18:50:50 +08:00
|
|
|
const currentTmpDir = global.settings.tmpDir;
|
|
|
|
|
2018-08-30 21:10:43 +08:00
|
|
|
const dynamicTmpDir = `/tmp/${new Date().getTime()}/a/b/c`;
|
|
|
|
global.settings.tmpDir = dynamicTmpDir;
|
2018-08-30 18:50:50 +08:00
|
|
|
server = server();
|
|
|
|
|
|
|
|
assert.response(server, {
|
|
|
|
url: '/api/v1/sql?' + querystring.stringify({
|
2019-12-24 01:19:08 +08:00
|
|
|
q: 'SELECT 1'
|
2018-08-30 18:50:50 +08:00
|
|
|
}),
|
|
|
|
headers: { host: 'vizzuality.cartodb.com' },
|
|
|
|
method: 'GET'
|
2019-12-24 01:19:08 +08:00
|
|
|
}, {}, function (err, res) {
|
2018-08-30 18:50:50 +08:00
|
|
|
assert.ifError(err);
|
|
|
|
assert.ok(res.statusCode === 200);
|
2018-08-30 21:10:43 +08:00
|
|
|
assert.ok(fs.existsSync(dynamicTmpDir));
|
2018-08-30 18:50:50 +08:00
|
|
|
|
|
|
|
global.settings.tmpDir = currentTmpDir;
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|