Merge branch 'master' into 691-date-histogram

This commit is contained in:
Daniel García Aubert
2017-08-01 16:07:27 +02:00
26 changed files with 1357 additions and 251 deletions
+16 -5
View File
@@ -75,6 +75,11 @@ module.exports.CARTOCSS = {
].join('\n')
};
module.exports.SQL = {
EMPTY: 'select 1 as cartodb_id, null::geometry as the_geom_webmercator',
ONE_POINT: 'select 1 as cartodb_id, \'SRID=3857;POINT(0 0)\'::geometry the_geom_webmercator'
}
TestClient.prototype.getWidget = function(widgetName, params, callback) {
var self = this;
@@ -525,7 +530,7 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
};
var expectedResponse = {
status: 200,
status: params.status || 200,
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
@@ -542,7 +547,12 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
if (isMvt) {
request.encoding = 'binary';
expectedResponse.headers['Content-Type'] = 'application/x-protobuf';
if (expectedResponse.status === 200) {
expectedResponse.headers['Content-Type'] = 'application/x-protobuf';
} else if (expectedResponse.status === 204) {
expectedResponse.headers['Content-Type'] = undefined;
}
}
var isGeojson = format.match(/geojson$/);
@@ -561,15 +571,16 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
assert.response(server, request, expectedResponse, function(res, err) {
assert.ifError(err);
var obj;
if (isPng) {
obj = mapnik.Image.fromBytes(new Buffer(res.body, 'binary'));
}
else if (isMvt) {
obj = new mapnik.VectorTile(z, x, y);
obj.setDataSync(new Buffer(res.body, 'binary'));
if (res.body) {
obj = new mapnik.VectorTile(z, x, y);
obj.setDataSync(new Buffer(res.body, 'binary'));
}
}
else {
obj = JSON.parse(res.body);