Add test for cache flushing (see #183)

This commit is contained in:
Sandro Santilli 2012-10-05 16:50:39 +02:00
parent fb57819741
commit 0a57e791d5

View File

@ -539,6 +539,42 @@ suite('server', function() {
}); });
}); });
/////////////////////////////////////////////////////////////////////////////////
//
// DELETE CACHE
//
/////////////////////////////////////////////////////////////////////////////////
test("forbids flushing cache without specifying table name", function(done) {
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/flush_cache',
method: 'DELETE'
},{}, function(res) {
assert.equal(res.statusCode, 404, res.statusCode + ': ' + res.body);
done();
});
});
test("allows flushing table cache by unauthenticated user", function(done) {
assert.response(server, {
headers: {host: 'localhost'},
url: '/tiles/gadm4/flush_cache',
method: 'DELETE'
},{}, function(res) {
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
// TODO: also check that varnish is signalled (using VarnishEmu)
// NOTE: requires enable_cache=1 in test.js
done();
});
});
/////////////////////////////////////////////////////////////////////////////////
//
// Tear down
//
/////////////////////////////////////////////////////////////////////////////////
suiteTeardown(function(done) { suiteTeardown(function(done) {
// This test will add map_style records, like // This test will add map_style records, like
// 'map_style|null|publicuser|my_table', // 'map_style|null|publicuser|my_table',