[TEST] Added create api (hardcoded) to REST tests suite as it has no spec but it's just a variation of the index api

This commit is contained in:
Luca Cavanna 2014-01-20 11:51:06 +01:00
parent ae71b25145
commit 3d0c06e2f4
1 changed files with 16 additions and 0 deletions

View File

@ -38,6 +38,22 @@ public class RestSpec {
} }
void addApi(RestApi restApi) { void addApi(RestApi restApi) {
if ("index".equals(restApi.getName())) {
RestApi create = new RestApi("create");
create.addPath("/{index}/{type}");
create.addPath("/{index}/{type}/{id}/_create");
create.setBodyRequired();
for (String method : restApi.getMethods()) {
create.addMethod(method);
}
for (String param : restApi.getParams()) {
create.addParam(param);
}
for (String pathPart : restApi.getPathParts()) {
create.addPathPart(pathPart);
}
restApiMap.put(create.getName(), create);
}
restApiMap.put(restApi.getName(), restApi); restApiMap.put(restApi.getName(), restApi);
} }