Rationalize acceptance test dividing tests in sections

This commit is contained in:
Sandro Santilli 2012-08-14 15:06:04 +02:00
parent b5348db94c
commit 070c6da6da

View File

@ -11,6 +11,13 @@ server.setMaxListeners(0);
suite('server', function() { suite('server', function() {
/////////////////////////////////////////////////////////////////////////////////
//
// GET UNSUPPORTED
//
/////////////////////////////////////////////////////////////////////////////////
// TOSO: I guess this should be a 404 instead...
test("get call to server returns 200", function(done){ test("get call to server returns 200", function(done){
assert.response(server, { assert.response(server, {
url: '/', url: '/',
@ -20,6 +27,12 @@ suite('server', function() {
}, function() { done(); }); }, function() { done(); });
}); });
/////////////////////////////////////////////////////////////////////////////////
//
// GET STYLE
//
/////////////////////////////////////////////////////////////////////////////////
test("get'ing blank style returns default style", function(done){ test("get'ing blank style returns default style", function(done){
assert.response(server, { assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'}, headers: {host: 'vizzuality.localhost.lan'},
@ -31,6 +44,12 @@ suite('server', function() {
}, function() { done(); }); }, function() { done(); });
}); });
/////////////////////////////////////////////////////////////////////////////////
//
// POST STYLE
//
/////////////////////////////////////////////////////////////////////////////////
test("post'ing no style returns 400 with errors", function(done){ test("post'ing no style returns 400 with errors", function(done){
assert.response(server, { assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'}, headers: {host: 'vizzuality.localhost.lan'},
@ -118,6 +137,12 @@ suite('server', function() {
}); });
/////////////////////////////////////////////////////////////////////////////////
//
// DELETE STYLE
//
/////////////////////////////////////////////////////////////////////////////////
// Test that unauthenticated DELETE should fail // Test that unauthenticated DELETE should fail
// See https://github.com/Vizzuality/cartodb-management/issues/155 // See https://github.com/Vizzuality/cartodb-management/issues/155
test("delete'ing style with no authentication returns an error", function(done){ test("delete'ing style with no authentication returns an error", function(done){
@ -168,6 +193,12 @@ suite('server', function() {
}); });
}); });
/////////////////////////////////////////////////////////////////////////////////
//
// GET INFOWINDOW
//
/////////////////////////////////////////////////////////////////////////////////
test("get'ing blank infowindow returns blank", function(done){ test("get'ing blank infowindow returns blank", function(done){
assert.response(server, { assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'}, headers: {host: 'vizzuality.localhost.lan'},
@ -202,18 +233,23 @@ suite('server', function() {
}, function() { done(); }); }, function() { done(); });
}); });
test("get'ing a tile with default style should return an image", function(done){ /////////////////////////////////////////////////////////////////////////////////
//
// GET GRID
//
/////////////////////////////////////////////////////////////////////////////////
test("get'ing a json with default style should return an grid", function(done){
assert.response(server, { assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'}, headers: {host: 'vizzuality.localhost.lan'},
url: '/tiles/gadm4/6/31/24.png?geom_type=polygon', url: '/tiles/gadm4/6/31/24.grid.json',
method: 'GET' method: 'GET'
},{ },{
status: 200, status: 200,
headers: { 'Content-Type': 'image/png' } headers: { 'Content-Type': 'text/javascript; charset=utf-8; charset=utf-8' }
}, function() { done(); }); }, function() { done(); });
}); });
test("get'ing a json with default style should return an grid", function(done){ test("get'ing a json with default style should return an grid", function(done){
assert.response(server, { assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'}, headers: {host: 'vizzuality.localhost.lan'},
@ -237,6 +273,22 @@ suite('server', function() {
}, function() { done(); }); }, function() { done(); });
}); });
/////////////////////////////////////////////////////////////////////////////////
//
// GET TILE
//
/////////////////////////////////////////////////////////////////////////////////
test("get'ing a tile with default style should return an image", function(done){
assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'},
url: '/tiles/gadm4/6/31/24.png?geom_type=polygon',
method: 'GET'
},{
status: 200,
headers: { 'Content-Type': 'image/png' }
}, function() { done(); });
});
test("get'ing a tile with default style and sql should return a constrained image", function(done){ test("get'ing a tile with default style and sql should return a constrained image", function(done){
var sql = querystring.stringify({sql: "SELECT * FROM gadm4 WHERE codineprov = '08'"}); var sql = querystring.stringify({sql: "SELECT * FROM gadm4 WHERE codineprov = '08'"});