Fix testsuite with GDAL-1.11dev installed (current master)

This commit is contained in:
Sandro Santilli 2014-04-02 17:17:59 +02:00
parent 9d91f17d47
commit 4606a44917

View File

@ -271,8 +271,11 @@ test('GET /api/v1/sql as kml with no rows', function(done){
method: 'GET' method: 'GET'
},{ }, function(res){ },{ }, function(res){
assert.equal(res.statusCode, 200, res.body); assert.equal(res.statusCode, 200, res.body);
var body = '<?xml version="1.0" encoding="utf-8" ?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Folder><name>cartodb_query</name></Folder></Document></kml>'; // NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output
assert.equal(res.body.replace(/\n/g,''), body); var pat = RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?><kml xmlns="http://www.opengis.net/kml/2.2"><Document( id="root_doc")?><Folder><name>cartodb_query</name></Folder></Document></kml>$');
var body = res.body.replace(/\n/g,'');
assert.ok(body.match(pat),
"Response:\n" + body + '\ndoes not match pattern:\n' + pat);
done(); done();
}); });
}); });
@ -288,8 +291,11 @@ test('GET /api/v1/sql as kml with ending semicolon', function(done){
method: 'GET' method: 'GET'
},{ }, function(res){ },{ }, function(res){
assert.equal(res.statusCode, 200, res.body); assert.equal(res.statusCode, 200, res.body);
var body = '<?xml version="1.0" encoding="utf-8" ?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Folder><name>cartodb_query</name></Folder></Document></kml>'; // NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output
assert.equal(res.body.replace(/\n/g,''), body); var pat = RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?><kml xmlns="http://www.opengis.net/kml/2.2"><Document( id="root_doc")?><Folder><name>cartodb_query</name></Folder></Document></kml>$');
var body = res.body.replace(/\n/g,'');
assert.ok(body.match(pat),
"Response:\n" + body + '\ndoes not match pattern:\n' + pat);
done(); done();
}); });
}); });