diff --git a/test/acceptance/server.js b/test/acceptance/server.js index 528d9641..b8f6fc61 100644 --- a/test/acceptance/server.js +++ b/test/acceptance/server.js @@ -116,132 +116,6 @@ suite.skip('server old_api', function() { var test_style_black_210 = "#test_table{marker-fill:black;marker-line-color:red;marker-width:20}"; - test("post'ing good style returns 200", function(done){ - assert.response(server, { - url: '/tiles/my_table5/style?map_key=1234', - method: 'POST', - headers: {host: 'localhost', 'Content-Type': 'application/x-www-form-urlencoded' }, - data: querystring.stringify({style: 'Map { background-color:#fff; }'}) - },{ - }, function(res) { - assert.equal(res.statusCode, 200, res.body); - done(); - }); - }); - - // See https://github.com/Vizzuality/Windshaft-cartodb/issues/38 - test("post'ing good style with auth passed as api_key returns 200", function(done){ - assert.response(server, { - url: '/tiles/my_table5/style?api_key=1234', - method: 'POST', - headers: {host: 'localhost', 'Content-Type': 'application/x-www-form-urlencoded' }, - data: querystring.stringify({style: 'Map { background-color:#fff; }'}) - },{}, function(res) { - assert.equal(res.statusCode, 200, res.body); - done(); - }); - }); - - // See https://github.com/Vizzuality/cartodb-management/issues/155 - test("post'ing good style with no authentication returns an error", function(done){ - assert.response(server, { - url: '/tiles/my_table5/style?map_key=1234', - method: 'POST', - headers: {host: 'localhost', 'Content-Type': 'application/x-www-form-urlencoded' }, - data: querystring.stringify({style: 'Map { background-color:#fff; }'}) - },{ - }, function(res) { - assert.equal(res.statusCode, 200, res.body); - assert.response(server, { - url: '/tiles/my_table5/style', - method: 'POST', - headers: {host: 'localhost', 'Content-Type': 'application/x-www-form-urlencoded' }, - data: querystring.stringify({style: 'Map { background-color:#aaa; }'}) - },{}, function(res) { - // FIXME: should be 403 Forbidden - assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); - assert.ok(res.body.indexOf('map state cannot be changed by unauthenticated request') != -1, res.body); - - assert.response(server, { - headers: {host: 'localhost'}, - url: '/tiles/my_table5/style', - method: 'GET' - },{ - status: 200 - }, function(res) { - var parsed = JSON.parse(res.body); - assert.equal(parsed.style, 'Map { background-color:#fff; }'); - assert.equal(parsed.style_version, '2.0.0'); - done(); - }); - - }); - }); - }); - - test("post'ing good style returns 200 then getting returns original style", function(done){ - var style = 'Map { background-color:#fff; }'; - assert.response(server, { - url: '/tiles/my_table5/style?map_key=1234', - method: 'POST', - headers: {host: 'localhost', 'Content-Type': 'application/x-www-form-urlencoded' }, - data: querystring.stringify({style: style, style_version: '2.0.2'}) - },{}, function(res) { - - assert.equal(res.statusCode, 200, res.body); - - assert.response(server, { - headers: {host: 'localhost'}, - url: '/tiles/my_table5/style', - method: 'GET' - },{}, function(res) { - assert.equal(res.statusCode, 200, res.body); - var parsed = JSON.parse(res.body); - assert.equal(parsed.style, style); - assert.equal(parsed.style_version, '2.0.2'); - - assert.response(server, { - headers: {host: 'localhost'}, - url: '/tiles/my_table5/style?style_convert=true', - method: 'GET' - },{}, function(res) { - assert.equal(res.statusCode, 200, res.body); - var parsed = JSON.parse(res.body); - assert.equal(parsed.style, style); - assert.equal(parsed.style_version, mapnik_version); - done(); - }); - }); - - }); - - }); - - test("post'ing good style with style_convert returns 200 then getting returns converted style", function(done){ - var style = 'Map { background-color:#fff; }'; - assert.response(server, { - url: '/tiles/my_table5/style?map_key=1234', - method: 'POST', - headers: {host: 'localhost', 'Content-Type': 'application/x-www-form-urlencoded' }, - data: querystring.stringify({style: style, style_version: '2.0.2', style_convert: true}) - },{}, function(res) { - - assert.equal(res.statusCode, 200, res.body); - assert.response(server, { - headers: {host: 'localhost'}, - url: '/tiles/my_table5/style', - method: 'GET' - },{}, function(res) { - assert.equal(res.statusCode, 200, res.body); - var parsed = JSON.parse(res.body); - // NOTE: no transform expected for the specific style - assert.equal(parsed.style, style); - assert.equal(parsed.style_version, mapnik_version); - done(); - }); - }); - }); - ///////////////////////////////////////////////////////////////////////////////// // // DELETE STYLE