diff options
Diffstat (limited to 'test/postman/05_Onboard_VF.postman_collection.json')
-rw-r--r-- | test/postman/05_Onboard_VF.postman_collection.json | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/test/postman/05_Onboard_VF.postman_collection.json b/test/postman/05_Onboard_VF.postman_collection.json index 9b49aa4c8..19a83a0d3 100644 --- a/test/postman/05_Onboard_VF.postman_collection.json +++ b/test/postman/05_Onboard_VF.postman_collection.json @@ -15,24 +15,30 @@ "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);", + " }", "}" ] } |