Replace lzma test with multilayer

This commit is contained in:
Raul Ochoa 2015-03-30 15:01:17 +02:00
parent d6ef0b7457
commit c92e786a5f
2 changed files with 34 additions and 45 deletions

View File

@ -1,9 +1,8 @@
require(__dirname + '/../support/test_helper');
var testHelper = require(__dirname + '/../support/test_helper');
var assert = require('../support/assert');
var redis = require('redis');
var _ = require('underscore');
var CartodbWindshaft = require('../../lib/cartodb/cartodb_windshaft');
var serverOptions = require('../../lib/cartodb/server_options')();
@ -156,4 +155,36 @@ describe('tests from old api translated to multilayer', function() {
);
});
it("creating a layergroup from lzma param", function(done){
var params = {
config: JSON.stringify(singleLayergroupConfig(pointSql, '#layer { marker-fill:red; }'))
};
testHelper.lzma_compress_to_base64(JSON.stringify(params), 1, function(err, lzma) {
if (err) {
return done(err);
}
assert.response(server,
{
url: layergroupUrl + '?lzma=' + encodeURIComponent(lzma),
method: 'GET',
headers: {
host: 'localhost'
},
encoding: 'binary'
},
{
status: 200
},
function(res) {
var parsed = JSON.parse(res.body);
assert.ok(parsed.layergroupid);
done();
}
);
});
});
});

View File

@ -64,54 +64,12 @@ suite('server', function() {
});
});
suite.skip('server old_api', function() {
suite('server old_api', function() {
var redis_client = redis.createClient(global.environment.redis.port);
var test_database = _.template(global.environment.postgres_auth_user, {user_id:1}) + '_db';
// A couple of styles to use during testing
var test_style_black_210 = "#test_table{marker-fill:black;marker-line-color:red;marker-width:20}";
test("get'ing a tile with url specified 2.1.0 style (lzma version)", function(done){
var qo = {
style: test_style_black_210,
style_version: '2.1.0',
cache_buster: 5
};
step (
function compressQuery () {
//console.log("Compressing starts");
helper.lzma_compress_to_base64(JSON.stringify(qo), 1, this);
},
function sendRequest(err, lzma) {
if ( err ) throw err;
var next = this;
//console.log("Compressing ends: " + typeof(lzma) + " - " + lzma);
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/test_table/15/16046/12354.png?lzma=' + encodeURIComponent(lzma),
method: 'GET',
encoding: 'binary'
},{}, function(res) { next(null, res); });
},
function checkResponse(err, res) {
if ( err ) throw err;
var next = this;
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
var ct = res.headers['content-type'];
assert.equal(ct, 'image/png');
assert.imageEqualsFile(res.body, './test/fixtures/test_table_15_16046_12354_styled_black.png',
IMAGE_EQUALS_TOLERANCE_PER_MIL, function(err/*, similarity*/) {
next(err);
});
},
function finish(err) {
done(err);
}
);
});
test("uses sqlapi to figure source data of query", function(done){
var qo = {
sql: "SELECT g.cartodb_id, g.codineprov, t.the_geom_webmercator" +