No need to test style deletion

This commit is contained in:
Raul Ochoa 2015-03-30 12:42:57 +02:00
parent ec2fcad2e0
commit 41521b6776

View File

@ -116,86 +116,6 @@ suite.skip('server old_api', function() {
var test_style_black_210 = "#test_table{marker-fill:black;marker-line-color:red;marker-width:20}";
/////////////////////////////////////////////////////////////////////////////////
//
// DELETE STYLE
//
/////////////////////////////////////////////////////////////////////////////////
// Test that unauthenticated DELETE should fail
// See https://github.com/Vizzuality/cartodb-management/issues/155
test("delete'ing style with no authentication returns an error", function(done){
assert.response(server, {
url: '/tiles/my_table5/style',
method: 'DELETE',
headers: {host: 'localhost'}
},{}, function(res) {
// FIXME: should be 403 Forbidden
assert.equal(res.statusCode, 400, res.body);
assert.ok(res.body.indexOf('map state cannot be changed by unauthenticated request') != -1, res.body);
// check that the style wasn't really deleted !
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/my_table5/style?map_key=1234',
method: 'GET'
},{
status: 200
}, function(res) {
var parsed = JSON.parse(res.body);
assert.equal(parsed.style, 'Map { background-color:#fff; }');
//assert.equal(parsed.version, '2.0.0');
done();
});
});
});
test("delete'ing style returns 200 then getting returns default style", function(done){
// this is the default style
var style = _.template(default_style, {table: 'my_table5'});
assert.response(server, {
url: '/tiles/my_table5/style?map_key=1234',
method: 'DELETE',
headers: {host: 'localhost'}
},{}, function(res) {
assert.equal(res.statusCode, 200, res.body);
// Retrive style with authenticated request
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/my_table5/style?map_key=1234',
method: 'GET'
},{}, function(res) {
assert.equal(res.statusCode, 200, res.body);
assert.deepEqual(JSON.parse(res.body).style, style);
// Now retrive style with unauthenticated request
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/my_table5/style',
method: 'GET'
}, {}, function(res) {
assert.equal(res.statusCode, 200, res.body);
assert.deepEqual(JSON.parse(res.body).style, style);
done();
});
});
});
});
// See https://github.com/Vizzuality/Windshaft-cartodb/issues/38
test("delete'ing style with api_key is accepted", function(done){
assert.response(server, {
url: '/tiles/my_table5/style?api_key=1234',
method: 'DELETE',
headers: {host: 'localhost'}
},{}, function(res) {
assert.equal(res.statusCode, 200, res.body);
done();
});
});
/////////////////////////////////////////////////////////////////////////////////
//
// GET GRID