diff --git a/api/jobs/gears.py b/api/jobs/gears.py index 578c9f833cb050c37fee3915126c539e2970d2e2..13501313611b5bfd6f63e9c52e8b1f051323a12f 100644 --- a/api/jobs/gears.py +++ b/api/jobs/gears.py @@ -22,7 +22,7 @@ def get_gears(fields=None): if fields is None: return config.db.gears.find() else: - fields.append('name') + fields.append('gear.name') for f in fields: projection[f] = 1 @@ -32,7 +32,7 @@ def get_gears(fields=None): def get_gear_by_name(name): # Find a gear from the list by name - gear_doc = config.db.gears.find_one({'name': name}) + gear_doc = config.db.gears.find_one({'gear.name': name}) if gear_doc is None: raise Exception('Unknown gear ' + name) @@ -40,7 +40,7 @@ def get_gear_by_name(name): return gear_doc def get_invocation_schema(gear): - return gear_tools.derive_invocation_schema(gear['manifest']) + return gear_tools.derive_invocation_schema(gear['gear']) def suggest_container(gear, cont_name, cid): """ @@ -51,7 +51,7 @@ def suggest_container(gear, cont_name, cid): invocation_schema = get_invocation_schema(gear) schemas = {} - for x in gear['manifest']['inputs']: + for x in gear['gear']['inputs']: schema = gear_tools.isolate_file_invocation(invocation_schema, x) schemas[x] = Draft4Validator(schema) @@ -74,16 +74,24 @@ def suggest_container(gear, cont_name, cid): return root def insert_gear(doc): - gear_tools.validate_manifest(doc['manifest']) + gear_tools.validate_manifest(doc['gear']) + + # This can be mongo-escaped and re-used later + if doc.get("invocation-schema"): + del(doc["invocation-schema"]) config.db.gears.insert(doc) if config.get_item('queue', 'prefetch'): log.info('Queuing prefetch job for gear ' + doc['name']) - job = Job(doc['manifest']['name'], {}, destination={}, tags=['prefetch'], request={ + job = Job(doc['gear']['name'], {}, destination={}, tags=['prefetch'], request={ 'inputs': [ - doc['input'] + { + 'type': 'http', + 'uri': doc['exchange']['rootfs-url'], + 'vu': 'vu0:x-' + doc['exchange']['rootfs-hash'] + } ], 'target': { 'command': ['uname', '-a'], @@ -96,10 +104,10 @@ def insert_gear(doc): return job.insert() def remove_gear(name): - config.db.gears.remove({"name": name}) + config.db.gears.remove({'gear.name': name}) def upsert_gear(doc): - gear_tools.validate_manifest(doc['manifest']) + gear_tools.validate_manifest(doc['gear']) - remove_gear(doc['name']) + remove_gear(doc['gear']['name']) insert_gear(doc) diff --git a/api/jobs/handlers.py b/api/jobs/handlers.py index c5bf326e2a6de60bca8073961a96f391b355db65..a6e7708a4cd481b966fc0e2f98169b3c3be2ef25 100644 --- a/api/jobs/handlers.py +++ b/api/jobs/handlers.py @@ -71,7 +71,7 @@ class GearHandler(base.RequestHandler): doc = self.request.json - if _id != doc.get('name', ''): + if _id != doc.get('gear', {}).get('name', ''): self.abort(400, 'Name key must be present and match URL') try: diff --git a/api/jobs/jobs.py b/api/jobs/jobs.py index 9395f21126218251ec6f62300cadbb6f6a41f87a..e47aaf9b03eb12ef460ac82dc6c8c854ff3bc7e1 100644 --- a/api/jobs/jobs.py +++ b/api/jobs/jobs.py @@ -207,7 +207,13 @@ class Job(object): """ r = { - 'inputs': [ ], + 'inputs': [ + { + 'type': 'http', + 'uri': gear['exchange']['rootfs-url'], + 'vu': 'vu0:x-' + gear['exchange']['rootfs-hash'] + } + ], 'target': { 'command': ['bash', '-c', 'rm -rf output; mkdir -p output; ./run; echo "Exit was $?"'], 'env': { @@ -224,9 +230,6 @@ class Job(object): ], } - # Add the gear - r['inputs'].append(gear['input']) - # Map destination to upload URI r['outputs'][0]['uri'] = '/engine?level=' + self.destination.type + '&id=' + self.destination.id diff --git a/api/jobs/rules.py b/api/jobs/rules.py index b161f80a31c899d89ddbf8f4610721fd232b1c06..d9d9141d5f2c73a92f6e49d28ea0d8e5c6064ab3 100644 --- a/api/jobs/rules.py +++ b/api/jobs/rules.py @@ -119,10 +119,10 @@ def queue_job_legacy(algorithm_id, input_): gear = gears.get_gear_by_name(algorithm_id) - if len(gear['manifest']['inputs']) != 1: + if len(gear['gear']['inputs']) != 1: raise Exception("Legacy gear enqueue attempt of " + algorithm_id + " failed: must have exactly 1 input in manifest") - input_name = gear['manifest']['inputs'].keys()[0] + input_name = gear['gear']['inputs'].keys()[0] inputs = { input_name: input_ diff --git a/raml/resources/gears.raml b/raml/resources/gears.raml index 180641bad7794ba33f220c9e6206c18f06bea696..7e9a968e3708cc353d43195eb076c35b9bb568f3 100644 --- a/raml/resources/gears.raml +++ b/raml/resources/gears.raml @@ -9,12 +9,6 @@ get: This parameter may be specified multiple times. type: string default: name - responses: - 200: - body: - application/json: - example: !include ../examples/gears_list_just_name.json - schema: !include ../schemas/output/gears-list.json /{GearName}: description: Interact with a specific gear @@ -28,15 +22,6 @@ get: "Name" field of gear must match "GearName" uri parameter If no existing gear is found, one will be created Otherwise, the specified gear will be updated - body: - application/json: - example: !include ../examples/gear_full.json - responses: - 200: - body: - application/json: - example: | - {"name":"dcm_convert"} get: description: Retrieve details about a specific gear responses: diff --git a/raml/resources/jobs.raml b/raml/resources/jobs.raml index 89e053a25a252e755ad461446a0f88d4dc4a3b3e..eaee61f36e8ae86bac975e2557fb409ea58b8c1f 100644 --- a/raml/resources/jobs.raml +++ b/raml/resources/jobs.raml @@ -26,12 +26,7 @@ get: description: Used by the engine get: description: Get the next job in the queue - responses: - 200: - body: - application/json: - example: !include ../examples/output/job-next.json - schema: !include ../schemas/output/job-next.json + /stats: description: Job stats get: diff --git a/test/integration_tests/postman/integration_tests.postman_collection b/test/integration_tests/postman/integration_tests.postman_collection index e163878766544f3a1c7b71c5e8f80d6f4ac48550..a6f651ee53d6c8231bedf2c581b0bca73d855fbf 100644 --- a/test/integration_tests/postman/integration_tests.postman_collection +++ b/test/integration_tests/postman/integration_tests.postman_collection @@ -2,7 +2,7 @@ "variables": [], "info": { "name": "test", - "_postman_id": "6d49872e-3762-3a9a-3cd1-e2f72b9a8128", + "_postman_id": "03089f3b-3670-9613-0c41-6b3b6927e9ea", "description": "", "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" }, @@ -14,7 +14,9 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] } } ], @@ -48,7 +50,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 400\"] = responseCode.code === 400;\n\ntests[\"Body has validation error message\"] = responseBody.has(\"'firstname' is a required property\");" + "exec": [ + "tests[\"Status code is 400\"] = responseCode.code === 400;", + "", + "tests[\"Body has validation error message\"] = responseBody.has(\"'firstname' is a required property\");" + ] } } ], @@ -82,7 +88,9 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] } } ], @@ -125,7 +133,12 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\nvar jsonData = JSON.parse(responseBody);\npostman.setGlobalVariable(\"test-group-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200 or 201\"] = (responseCode.code === 200 || responseCode.code === 201);", + "", + "var jsonData = JSON.parse(responseBody);", + "postman.setGlobalVariable(\"test-group-id\", jsonData._id);" + ] } } ], @@ -154,7 +167,16 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\ntests[\"Upload complte\"] = jsonData[0].name === \"test-1.dcm\";" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "if (jsonData && jsonData[0]) {", + " tests[\"Upload complte\"] = jsonData[0].name === \"test-1.dcm\";", + "}" + ] } } ], @@ -197,7 +219,19 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\nvar jsonData = JSON.parse(responseBody);\n\ntests[\"test-session-1 is first\"] = jsonData[0].label === \"test-session-1\";\n\npostman.setGlobalVariable(\"test-session-1\", jsonData[0]);\npostman.setGlobalVariable(\"test-session-1-id\", jsonData[0]._id);\npostman.setGlobalVariable(\"test-project-1-id\", jsonData[0].project);\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "tests[\"test-session-1 is first\"] = jsonData[0].label === \"test-session-1\";", + "", + "postman.setGlobalVariable(\"test-session-1\", jsonData[0]);", + "postman.setGlobalVariable(\"test-session-1-id\", jsonData[0]._id);", + "postman.setGlobalVariable(\"test-project-1-id\", jsonData[0].project);", + "", + "" + ] } } ], @@ -231,7 +265,16 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\nvar jsonData = JSON.parse(responseBody);\n\ntests[\"test-acquisition-1 is first\"] = jsonData[0].label === \"test-acquisition-1\";\n\npostman.setGlobalVariable(\"test-acquisition-1\", jsonData[0]);\npostman.setGlobalVariable(\"test-acquisition-1-id\", jsonData[0]._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "tests[\"test-acquisition-1 is first\"] = jsonData[0].label === \"test-acquisition-1\";", + "", + "postman.setGlobalVariable(\"test-acquisition-1\", jsonData[0]);", + "postman.setGlobalVariable(\"test-acquisition-1-id\", jsonData[0]._id);" + ] } } ], @@ -265,7 +308,9 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 400\"] = responseCode.code === 400;" + "exec": [ + "tests[\"Status code is 400\"] = responseCode.code === 400;" + ] } } ], @@ -294,7 +339,9 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] } } ], @@ -310,7 +357,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"name\": \"test-case-gear\",\n\t\"manifest\": {\n\t\t\"name\": \"test-case-gear\",\n\t\t\"label\": \"Test Case Gear\",\n\t\t\"version\": \"0\",\n\t\t\n\t\t\"author\": \"Nathaniel Kofalt\",\n\t\t\"description\": \"A gear built to drive test cases\",\n\t\t\n\t\t\"url\": \"http://none.example\",\n\t\t\"source\": \"http://none.example\",\n\t\t\"license\": \"MIT\",\n\t\t\n\t\t\"config\": {\n\t\t\t\"two-digit multiple of ten\": {\n\t\t\t\t\"exclusiveMaximum\": true,\n\t\t\t\t\"type\": \"number\",\n\t\t\t\t\"multipleOf\": 10,\n\t\t\t\t\"maximum\": 100\n\t\t\t}\n\t\t},\n\t\t\n\t\t\"inputs\": {\n\t\t\t\"any text file <= 100 KB\": {\n\t\t\t\t\"base\": \"file\",\n\t\t\t\t\"name\": {\n\t\t\t\t\t\"pattern\": \"^.*.txt$\"\n\t\t\t\t},\n\t\t\t\t\"size\": {\n\t\t\t\t\t\"maximum\": 100000\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"input\": {\n\t\t\"uri\":\"https://somewhere.notarealtopleveldomain/gears/foo.tar.gz\",\n\t\t\"type\":\"http\",\n\t\t\"location\":\"/\",\n\t\t\"vu\": \"vu0:sha384:tXvdI2pspng-YH6lwa2UcLsww0yR6LfEKbLm89eIqEGicLRHW9d1V8bs7gXHTlZ3\"\n\t}\n}" + "raw": "{\n \"category\" : \"converter\",\n \"gear\" : {\n \"inputs\" : {\n \"wat\" : {\n \"base\" : \"file\",\n \"type\" : {\n \"enum\" : [ \n \"wat\"\n ]\n }\n }\n },\n \"maintainer\" : \"Example\",\n \"description\" : \"Example\",\n \"license\" : \"BSD-2-Clause\",\n \"author\" : \"Example\",\n \"url\" : \"https://example.example\",\n \"label\" : \"wat\",\n \"flywheel\" : \"0\",\n \"source\" : \"https://example.example\",\n \"version\" : \"0.0.1\",\n \"config\" : {},\n \"name\" : \"test-case-gear\"\n },\n \"exchange\" : {\n \"git-commit\" : \"aex\",\n \"rootfs-hash\" : \"sha384:oy\",\n \"rootfs-url\" : \"https://example.example\"\n }\n}" }, "description": "" }, @@ -323,7 +370,9 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] } } ], @@ -352,7 +401,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"test-collection-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"test-collection-id\", jsonData._id);" + ] } } ], @@ -381,7 +437,10 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "" + ] } } ], @@ -410,7 +469,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\nvar jsonData = JSON.parse(responseBody);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var jsonData = JSON.parse(responseBody);" + ] } } ], @@ -447,7 +510,10 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "" + ] } } ], @@ -476,7 +542,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -513,7 +583,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -550,7 +624,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -579,7 +657,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -608,7 +690,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -637,7 +723,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -666,7 +756,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"test-session-1-analysis-1-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"test-session-1-analysis-1-id\", jsonData._id);" + ] } } ], @@ -700,7 +797,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"test-session-1-file-upload-analysis-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"test-session-1-file-upload-analysis-id\", jsonData._id);" + ] } } ], @@ -743,7 +847,12 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "" + ] } } ], @@ -777,7 +886,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"test-acquisition-1-analysis-1-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"test-acquisition-1-analysis-1-id\", jsonData._id);" + ] } } ], @@ -820,7 +936,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -863,7 +983,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"test-collection-1-analysis-1-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"test-collection-1-analysis-1-id\", jsonData._id);" + ] } } ], @@ -906,7 +1033,12 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);" + ] } } ], @@ -949,7 +1081,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"test-project-1-analysis-1-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"test-project-1-analysis-1-id\", jsonData._id);" + ] } } ], @@ -992,7 +1131,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -1035,7 +1178,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -1064,7 +1211,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -1093,7 +1244,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -1122,7 +1277,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -1151,7 +1310,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"ST-project-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"ST-project-id\", jsonData._id);" + ] } } ], @@ -1180,7 +1346,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"ST-compliant-session-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"ST-compliant-session-id\", jsonData._id);" + ] } } ], @@ -1209,7 +1382,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"ST-noncompliant-session-id\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"ST-noncompliant-session-id\", jsonData._id);" + ] } } ], @@ -1238,7 +1418,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"ST-cs-acquisition-1\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"ST-cs-acquisition-1\", jsonData._id);" + ] } } ], @@ -1267,7 +1454,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"ST-cs-acquisition-2\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"ST-cs-acquisition-2\", jsonData._id);" + ] } } ], @@ -1296,7 +1490,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"ST-ncs-acquisition-1\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"ST-ncs-acquisition-1\", jsonData._id);" + ] } } ], @@ -1325,7 +1526,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\ntests[\"Project updated\"] = jsonData.modified == 1;" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "tests[\"Project updated\"] = jsonData.modified == 1;" + ] } } ], @@ -1354,7 +1562,16 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\ntests[\"Project has template marked\"] = jsonData.project_has_template === true;\n\ntests[\"Session marked as compliant\"] = jsonData.satisfies_template === true;" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "tests[\"Project has template marked\"] = jsonData.project_has_template === true;", + "", + "tests[\"Session marked as compliant\"] = jsonData.satisfies_template === true;" + ] } } ], @@ -1383,7 +1600,16 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\ntests[\"Project has template marked\"] = jsonData.project_has_template === true;\n\ntests[\"Session marked as compliant\"] = jsonData.satisfies_template === false;" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "tests[\"Project has template marked\"] = jsonData.project_has_template === true;", + "", + "tests[\"Session marked as compliant\"] = jsonData.satisfies_template === false;" + ] } } ], @@ -1412,7 +1638,14 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\npostman.setGlobalVariable(\"ST-ncs-acquisition-2\", jsonData._id);" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "postman.setGlobalVariable(\"ST-ncs-acquisition-2\", jsonData._id);" + ] } } ], @@ -1441,7 +1674,16 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\ntests[\"Project has template marked\"] = jsonData.project_has_template === true;\n\ntests[\"Session marked as compliant\"] = jsonData.satisfies_template === true;" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "tests[\"Project has template marked\"] = jsonData.project_has_template === true;", + "", + "tests[\"Session marked as compliant\"] = jsonData.satisfies_template === true;" + ] } } ], @@ -1470,7 +1712,11 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "" + ] } } ], @@ -1499,7 +1745,16 @@ "listen": "test", "script": { "type": "text/javascript", - "exec": "tests[\"Status code is 200\"] = responseCode.code === 200;\n\n\nvar jsonData = JSON.parse(responseBody);\n\ntests[\"Project has template marked\"] = jsonData.project_has_template === true;\n\ntests[\"Session marked as compliant\"] = jsonData.satisfies_template === false;" + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "", + "var jsonData = JSON.parse(responseBody);", + "", + "tests[\"Project has template marked\"] = jsonData.project_has_template === true;", + "", + "tests[\"Session marked as compliant\"] = jsonData.satisfies_template === false;" + ] } } ],