Some integration tests for different cases in named layers type
This commit is contained in:
@@ -16,7 +16,7 @@ MapConfigNamedLayersAdapter.prototype.getLayers = function(username, layers, cal
|
||||
if (layer.type === 'named') {
|
||||
|
||||
if (!layer.options.name) {
|
||||
return callback(new Error('Missing Named Map name in layer options'));
|
||||
return callback(new Error('Missing Named Map `name` in layer options'));
|
||||
}
|
||||
|
||||
var templateName = layer.options.name;
|
||||
@@ -24,8 +24,8 @@ MapConfigNamedLayersAdapter.prototype.getLayers = function(username, layers, cal
|
||||
var templateAuthTokens = layer.options.auth_tokens;
|
||||
|
||||
self.templateMaps.getTemplate(username, templateName, function(err, template) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
if (err || !template) {
|
||||
return callback(new Error("Template '" + templateName + "' of user '" + username + "' not found"));
|
||||
}
|
||||
|
||||
if (self.templateMaps.isAuthorized(template, templateAuthTokens)) {
|
||||
@@ -46,7 +46,7 @@ MapConfigNamedLayersAdapter.prototype.getLayers = function(username, layers, cal
|
||||
return callback(err);
|
||||
}
|
||||
} else {
|
||||
var unauthorizedError = new Error('Unauthorized template instantiation');
|
||||
var unauthorizedError = new Error("Unauthorized '" + templateName + "' template instantiation");
|
||||
// unauthorizedError.http_status = 403;
|
||||
return callback(unauthorizedError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user