diff --git a/dotCMS/src/main/java/com/dotcms/rest/BundleResource.java b/dotCMS/src/main/java/com/dotcms/rest/BundleResource.java index ab4125facaef..928cd3fc2a06 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/BundleResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/BundleResource.java @@ -445,7 +445,7 @@ private static Response buildResponseToDeleteEndpoint(final DeleteBundlesByIdent if (!notExistingBundles.isEmpty()) { message.append(String.format( - "The following bundles was not deleted because it does not exist: %s", + "The following bundles were not deleted because they don't exist: %s", notExistingBundles.stream().collect(Collectors.joining(", "))) ); } diff --git a/dotcms-postman/src/main/resources/postman/Bundle_Resource.postman_collection.json b/dotcms-postman/src/main/resources/postman/Bundle_Resource.postman_collection.json index f381069e97d0..56eb4321b94f 100644 --- a/dotcms-postman/src/main/resources/postman/Bundle_Resource.postman_collection.json +++ b/dotcms-postman/src/main/resources/postman/Bundle_Resource.postman_collection.json @@ -83,7 +83,7 @@ "});", "", "pm.test(\"Valid response\", function () {", - " pm.expect(pm.response.text()).to.include(\"The following bundles was not deleted because it does not exist: n0ex1st-18c1-4eb0-815e-981619635532\");", + " pm.expect(pm.response.text()).to.include(\"The following bundles were not deleted because they don't exist: n0ex1st-18c1-4eb0-815e-981619635532\");", "});", "" ], @@ -94,16 +94,11 @@ ], "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -635,22 +630,18 @@ "", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -684,16 +675,11 @@ "name": "Add Field to Content Type", "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -744,22 +730,18 @@ "", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -802,7 +784,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -816,22 +799,18 @@ " pm.collectionVariables.set(\"bundleId\", jsonData[\"bundleId\"]);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -882,7 +861,8 @@ "exec": [ "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -893,22 +873,18 @@ " pm.response.to.have.status(200);", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -964,7 +940,7 @@ "var bundleId = pm.collectionVariables.get(\"bundleId\");", "", "pm.test(\"Valid response\", function () {", - " pm.expect(pm.response.text()).to.include('Removing the follow bundles in a separated process, the result of the operation will be notified: ' + bundleId + ', The following bundles was not deleted because it does not exist: n0ex1st-18c1-4eb0-815e-981619635532');", + " pm.expect(pm.response.text()).to.include('Removing the follow bundles in a separated process, the result of the operation will be notified: ' + bundleId + \", The following bundles were not deleted because they don't exist: n0ex1st-18c1-4eb0-815e-981619635532\");", "});", "" ], @@ -975,16 +951,11 @@ ], "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -1048,22 +1019,18 @@ "}", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -1113,16 +1080,11 @@ ], "request": { "auth": { - "type": "basic", - "basic": [ + "type": "bearer", + "bearer": [ { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "admin", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -1181,16 +1143,11 @@ ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - }, + "type": "bearer", + "bearer": [ { - "key": "password", - "value": "admin", + "key": "token", + "value": "{{jwt}}", "type": "string" } ] @@ -2976,6 +2933,67 @@ ] } ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + " const serverURL = pm.environment.get('serverURL'); // Get the server URL from the environment variable", + " const apiUrl = `${serverURL}/api/v1/apitoken`; // Construct the full API URL", + "", + "// If we are unable to get the JWT we need to generate a new one", + " if (!pm.environment.get('jwt')) {", + " const username = pm.environment.get(\"user\");", + " const password = pm.environment.get(\"password\");", + " const basicAuth = Buffer.from(`${username}:${password}`).toString('base64');", + "", + "", + " const requestOptions = {", + " url: apiUrl,", + " method: \"POST\",", + " header: {", + " \"accept\": \"*/*\",", + " \"content-type\": \"application/json\",", + " \"Authorization\": `Basic ${basicAuth}`", + " },", + " body: {", + " mode: \"raw\",", + " raw: JSON.stringify({", + " \"expirationSeconds\": 7200,", + " \"userId\": \"dotcms.org.1\",", + " \"network\": \"0.0.0.0/0\",", + " \"claims\": {\"label\": \"postman-tests\"}", + " })", + " }", + " };", + "", + "", + " pm.sendRequest(requestOptions, function (err, response) {", + " if (err) {", + " console.log(err);", + " } else {", + " const jwt = response.json().entity.jwt;", + " pm.environment.set('jwt', jwt);", + " console.log(jwt);", + " }", + " });", + " }" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ], "variable": [ { "key": "bundleName",