diff --git a/.github/workflows/test_controlplane_management.yml b/.github/workflows/test_controlplane_management.yml index 556c1473..73fde836 100644 --- a/.github/workflows/test_controlplane_management.yml +++ b/.github/workflows/test_controlplane_management.yml @@ -97,5 +97,5 @@ jobs: - name: "Run Newman" working-directory: ./deployment/postman run: |- - newman run "MVD.postman_collection.json" -e "MVD K8S.postman_environment.json" --folder "ControlPlane Management" --delay-request 5000 + newman run "MVD.postman_collection.json" -e "MVD K8S.postman_environment.json" --folder "ControlPlane Management" --delay-request 5000 --verbose diff --git a/deployment/postman/MVD.postman_collection.json b/deployment/postman/MVD.postman_collection.json index e3dcb33b..059e902a 100644 --- a/deployment/postman/MVD.postman_collection.json +++ b/deployment/postman/MVD.postman_collection.json @@ -447,9 +447,11 @@ "script": { "exec": [ "// get the policy id of \"asset-1\" and save it as an environment variable", - "const dcat_datasets = pm.response.json()[0][\"dcat:dataset\"][1][\"dcat:dataset\"]", - "const asset_1 = dcat_datasets.find((asset) => asset[\"@id\"] == \"asset-1\")", - "pm.environment.set(\"POLICY_ID_ASSET_1\", asset_1[\"odrl:hasPolicy\"][\"@id\"]);", + "if(pm.response.code < 300 && pm.response.code >= 200 && pm.response.json().length > 0){", + " const dcat_datasets = pm.response.json()[0][\"dcat:dataset\"][1][\"dcat:dataset\"]", + " const asset_1 = dcat_datasets.find((asset) => asset[\"@id\"] == \"asset-1\")", + " pm.environment.set(\"POLICY_ID_ASSET_1\", asset_1[\"odrl:hasPolicy\"][\"@id\"]);", + "}", "", "" ], @@ -560,7 +562,7 @@ "script": { "exec": [ "// get the contact agreement id and save it as an environment variable", - "if(pm.response.code < 300 && pm.response.code >= 200){", + "if(pm.response.code < 300 && pm.response.code >= 200 && pm.response.json().length > 0){", " //using the first contract agreement id found", " const contractAgreementId = pm.response.json()[0][\"contractAgreementId\"];", " pm.environment.set(\"CONTRACT_AGREEMENT_ID\", contractAgreementId);", @@ -714,13 +716,8 @@ "listen": "test", "script": { "exec": [ - "response = pm.response.json();", - "pm.test('Body is not empty', () =>{", - " pm.expect(response.length).to.be.greaterThan(0);", - "})", - "", "// get the transfer process id of \"asset-1\" and save it as an environment variable if the response body is not empty", - "if(pm.response.code < 300 && pm.response.code >= 200 && response.length > 0){", + "if(pm.response.code < 300 && pm.response.code >= 200 && pm.response.json().length > 0){", " const transferProcessId = pm.response.json()[0][\"transferProcessId\"];", " pm.environment.set(\"TRANSFER_PROCESS_ID\", transferProcessId);", "}" @@ -729,22 +726,6 @@ "packages": {} } }, - { - "listen": "test", - "script": { - "exec": [ - "// get the transfer process id of \"asset-1\" and save it as an environment variable", - "if(pm.response.code < 300 && pm.response.code >= 200){", - " const transferProcessId = pm.response.json()[0][\"transferProcessId\"];", - " pm.environment.set(\"TRANSFER_PROCESS_ID\", transferProcessId);", - "}", - "", - "" - ], - "type": "text/javascript", - "packages": {} - } - }, { "listen": "test", "script": {