From 031e2a2e0c8255fa3fc6e6a01003fdaec0d2b9fc Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 10 Feb 2014 11:05:02 +0100 Subject: [PATCH] Add test for missing cartocss from mapnik layer on layergroup post See #133 --- test/acceptance/multilayer.js | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/acceptance/multilayer.js b/test/acceptance/multilayer.js index fc900fc3..3d900d5a 100644 --- a/test/acceptance/multilayer.js +++ b/test/acceptance/multilayer.js @@ -964,6 +964,46 @@ suite('multilayer', function() { ); }); + // See https://github.com/CartoDB/Windshaft-cartodb/issues/133 + test("MapConfig with mapnik layer and no cartocss", function(done) { + + var layergroup = { + version: '1.0.0', + layers: [ + { options: { + sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, 5e6, 0) as the_geom_webmercator from test_table limit 2', + interactivity: 'cartodb_id' + } } + ] + }; + + Step( + function do_post() + { + var next = this; + assert.response(server, { + url: '/tiles/layergroup', + method: 'POST', + headers: {host: 'localhost', 'Content-Type': 'application/json' }, + data: JSON.stringify(layergroup) + }, {}, function(res, err) { next(err, res); }); + }, + function check_post(err, res) { + if ( err ) throw err; + assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); + var parsed = JSON.parse(res.body); + assert.ok(parsed.errors, 'Missing "errors" in response: ' + JSON.stringify(parsed)); + assert.equal(parsed.errors.length, 1); + var msg = parsed.errors[0]; + assert.equal(msg, 'Missing cartocss for layer 0 options'); + return null; + }, + function finish(err) { + done(err); + } + ); + }); + suiteTeardown(function(done) {