add named maps GET auth tests

This commit is contained in:
Eneko Lakasta 2018-04-12 16:22:56 +02:00
parent f5bdb8b15b
commit 31e3b9953f
2 changed files with 599 additions and 451 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1483,6 +1483,46 @@ TestClient.prototype.updateTemplate = function (params, callback) {
break;
}
return callback(err, res, body);
});
};
TestClient.prototype.getTemplate = function (params, callback) {
if (!this.apiKey) {
return callback(new Error('apiKey param is mandatory to create a new template'));
}
const getTemplateRequest = {
url: `/api/v1/map/named/${params.templateId}?${qs.stringify({ api_key: this.apiKey })}`,
method: 'GET',
headers: {
host: 'localhost'
}
};
let getTemplateResponse = {
status: 200,
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
};
if (params.response) {
getTemplateResponse = Object.assign(getTemplateResponse, params.response);
}
assert.response(this.server, getTemplateRequest, getTemplateResponse, (res, err) => {
let body;
switch (res.headers['content-type']) {
case 'application/json; charset=utf-8':
body = JSON.parse(res.body);
break;
default:
body = res.body;
break;
}
return callback(err, res, body);
});
};