add named maps Listing auth tests

This commit is contained in:
Eneko Lakasta 2018-04-11 12:26:09 +02:00
parent 6a7c9e34a0
commit 9a3eb3e0fd

View File

@ -353,13 +353,14 @@ describe('authorization', function() {
testClient.drain(done); testClient.drain(done);
}); });
}); });
describe('Listing named maps', function() {
it('should fail while listing named maps with a regular apikey token', function (done) { it('should fail while listing named maps with a regular apikey token', function (done) {
const apikeyToken = 'regular1'; const apikeyToken = 'regular1';
const testClient = new TestClient({}, apikeyToken); const testClient = new TestClient({}, apikeyToken);
testClient.getNamedMapList({ response: {status: 403 }}, function (err, res, body) { testClient.getNamedMapList({ response: { status: 403 } }, function (err, res, body) {
assert.ifError(err); assert.ifError(err);
assert.equal(res.statusCode, 403); assert.equal(res.statusCode, 403);
@ -371,6 +372,40 @@ describe('authorization', function() {
}); });
}); });
it('should fail while listing named maps with the default apikey token', function (done) {
const apikeyToken = 'default_public';
const testClient = new TestClient({}, apikeyToken);
testClient.getNamedMapList({ response: { status: 403 } }, function (err, res, body) {
assert.ifError(err);
assert.equal(res.statusCode, 403);
assert.equal(body.errors.length, 1);
assert.ok(body.errors[0].match(/Forbidden/), body.errors[0]);
testClient.drain(done);
});
});
it('should fail while listing named maps with non-existent apikey token', function (done) {
const apikeyToken = 'wadus-wadus';
const testClient = new TestClient({}, apikeyToken);
testClient.getNamedMapList({ response: { status: 401 } }, function (err, res, body) {
assert.ifError(err);
assert.equal(res.statusCode, 401);
assert.equal(body.errors.length, 1);
assert.ok(body.errors[0].match(/Unauthorized/), body.errors[0]);
testClient.drain(done);
});
});
it('should list named maps with master apikey token', function (done) { it('should list named maps with master apikey token', function (done) {
const apikeyToken = 1234; const apikeyToken = 1234;
@ -385,6 +420,7 @@ describe('authorization', function() {
testClient.drain(done); testClient.drain(done);
}); });
}); });
});
it.skip('should create and get a named map tile using a regular apikey token', function (done) { it.skip('should create and get a named map tile using a regular apikey token', function (done) {
const apikeyToken = 'regular1'; const apikeyToken = 'regular1';