Add a test for COPY TO file

This commit is contained in:
Sandro Santilli 2013-01-21 17:39:07 +01:00
parent 977ecbeb29
commit fdf49bd2ab

View File

@ -348,6 +348,22 @@ test('COPY TABLE with GET and auth', function(done){
});
});
test('COPY TABLE with GET and auth', function(done){
assert.response(app, {
url: "/api/v1/sql?" + querystring.stringify({
q: "COPY test_table to '/tmp/x';",
api_key: 1234
}),
headers: {host: 'vizzuality.cartodb.com'},
method: 'GET'
},{}, function(res) {
// We expect a problem, actually
assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body);
assert.deepEqual(JSON.parse(res.body), {"error":["must be superuser to COPY to or from a file"]});
done();
});
});
test('ALTER TABLE with GET and auth', function(done){
assert.response(app, {
url: "/api/v1/sql?" + querystring.stringify({