migrated to node-varnish, fixed tests, refactor

This commit is contained in:
Simon Tokumine
2011-12-12 18:02:10 +00:00
parent d373124f5c
commit ef15f4b48b
12 changed files with 121 additions and 496 deletions
+5 -22
View File
@@ -32,8 +32,6 @@ tests["get'ing blank style returns default style"] = function(){
});
};
tests["post'ing no style returns 400 with errors"] = function(){
assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'},
@@ -45,8 +43,6 @@ tests["post'ing no style returns 400 with errors"] = function(){
});
};
tests["post'ing bad style returns 400 with error"] = function(){
assert.response(server, {
url: '/tiles/my_table3/style',
@@ -54,13 +50,11 @@ tests["post'ing bad style returns 400 with error"] = function(){
headers: {host: 'vizzuality.localhost.lan', 'Content-Type': 'application/x-www-form-urlencoded' },
data: querystring.stringify({style: '#my_table3{backgxxxxxround-color:#fff;}'})
},{
status: 400,
status: 500,
body: JSON.stringify(['style.mss:1:11 Unrecognized rule: backgxxxxxround-color'])
});
};
tests["post'ing multiple bad styles returns 400 with error array"] = function(){
assert.response(server, {
url: '/tiles/my_table4/style',
@@ -68,13 +62,11 @@ tests["post'ing multiple bad styles returns 400 with error array"] = function(){
headers: {host: 'vizzuality.localhost.lan', 'Content-Type': 'application/x-www-form-urlencoded' },
data: querystring.stringify({style: '#my_table4{backgxxxxxround-color:#fff;foo:bar}'})
},{
status: 400,
status: 500,
body: JSON.stringify([ 'style.mss:1:11 Unrecognized rule: backgxxxxxround-color', 'style.mss:1:38 Unrecognized rule: foo' ])
});
};
tests["post'ing good style returns 200"] = function(){
assert.response(server, {
url: '/tiles/my_table5/style',
@@ -86,9 +78,6 @@ tests["post'ing good style returns 200"] = function(){
});
};
tests["post'ing good style returns 200 then getting returns original style"] = function(){
var style = '#my_table5{background-color:#fff;}';
assert.response(server, {
@@ -111,7 +100,6 @@ tests["post'ing good style returns 200 then getting returns original style"] = f
});
};
tests["get'ing blank infowindow returns blank"] = function(){
assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'},
@@ -135,9 +123,6 @@ tests["get'ing blank infowindow with callback returns blank with callback"] = fu
};
// note requires:
// SELECT 0
// HSET rails:cartodb_user_123_db:my_table infowindow "this, that, the other"
tests["get'ing completed infowindow with callback returns information with callback"] = function(){
assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'},
@@ -172,9 +157,8 @@ tests["get'ing a json with default style should return an grid"] = function(){
});
};
tests["get'ing a json with default style and sql should return a constrained grid"] = function(){
var sql = querystring.stringify({sql: "(SELECT * FROM gadm4 WHERE name_2 = 'Murcia') as foo"})
var sql = querystring.stringify({sql: "SELECT * FROM gadm4 WHERE codineprov = '08'"})
assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'},
url: '/tiles/gadm4/6/31/24.grid.json?' + sql,
@@ -186,9 +170,8 @@ tests["get'ing a json with default style and sql should return a constrained gri
};
tests["get'ing a tile with default style and sql should return a constrained image"] = function(){
var sql = querystring.stringify({sql: "(SELECT * FROM gadm4 WHERE name_2 = 'Murcia') as foo"});
var sql = querystring.stringify({sql: "SELECT * FROM gadm4 WHERE codineprov = '08'"});
assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'},
url: '/tiles/gadm4/6/31/24.png?' + sql,
@@ -201,7 +184,7 @@ tests["get'ing a tile with default style and sql should return a constrained ima
tests["get'ing a tile with default style and complex sql should return a constrained image"] = function(){
var sql = querystring.stringify({sql: "(SELECT * FROM gadm4 WHERE name_2 = 'Murcia' AND id_1 > 950) as foo"})
var sql = querystring.stringify({sql: "SELECT * FROM gadm4 WHERE codineprov = '08' AND codccaa > 60"})
assert.response(server, {
headers: {host: 'vizzuality.localhost.lan'},
url: '/tiles/gadm4/6/31/24.png?' + sql,