"script": {
"type": "text/javascript",
"exec": [
- "tests[\"Status code is 200\"] = responseCode.code === 200;",
- "",
- "var jsonData = JSON.parse(responseBody);",
"var vf_found = false;",
- "for (var i = 0; i < jsonData.length; i++) { ",
- " if (jsonData[i][\"name\"] === postman.getGlobalVariable(\"vf_name\")) {",
- " vf_found = true;",
- " postman.setGlobalVariable(\"auto_vf_uuid\", \"\"+jsonData[i][\"uuid\"]+\"\");",
- " postman.setGlobalVariable(\"auto_vf_invariant_uuid\", \"\"+jsonData[i][\"invariantUUID\"]+\"\");",
- " }",
+ "if (responseCode.code === 404) {",
+ " tests[postman.getGlobalVariable(\"vf_name\")+\" does not exists\"] = true;",
"}",
- "if (vf_found === false) {",
- " tests[postman.getGlobalVariable(\"vf_name\")+\" does not exists, we continue the run\"] = true;",
- "}",
- "",
"else {",
- " tests[postman.getGlobalVariable(\"vf_name\")+\" already exists, stop the run\"] = true;",
- " postman.setNextRequest(null);",
+ " if (responseCode.code === 200) {",
+ " tests[\"Status code is 200\"] = responseCode.code === 200;",
+ " }",
+ " var jsonData = JSON.parse(responseBody);",
+ " for (var i = 0; i < jsonData.length; i++) { ",
+ " if (jsonData[i][\"name\"] === postman.getGlobalVariable(\"vf_name\")) {",
+ " vf_found = true;",
+ " postman.setGlobalVariable(\"auto_vf_uuid\", \"\"+jsonData[i][\"uuid\"]+\"\");",
+ " postman.setGlobalVariable(\"auto_vf_invariant_uuid\", \"\"+jsonData[i][\"invariantUUID\"]+\"\");",
+ " }",
+ " }",
+ " if (vf_found === false) {",
+ " tests[postman.getGlobalVariable(\"vf_name\")+\" does not exists, we continue the run\"] = true;",
+ " }",
+ " ",
+ " else {",
+ " tests[postman.getGlobalVariable(\"vf_name\")+\" already exists, stop the run\"] = true;",
+ " postman.setNextRequest(null);",
+ " }",
"}"
]
}