From e9c50054b1cfaf88e8855205e7aa7dae6e041e8a Mon Sep 17 00:00:00 2001 From: jdotcms Date: Tue, 16 Jan 2024 13:52:05 -0600 Subject: [PATCH] #26227 fixing the postman test --- .../src/curl-test/EMA.postman_collection.json | 553 +++--------------- 1 file changed, 86 insertions(+), 467 deletions(-) diff --git a/dotCMS/src/curl-test/EMA.postman_collection.json b/dotCMS/src/curl-test/EMA.postman_collection.json index 1b205f59a771..534c8fe50168 100644 --- a/dotCMS/src/curl-test/EMA.postman_collection.json +++ b/dotCMS/src/curl-test/EMA.postman_collection.json @@ -7,483 +7,53 @@ }, "item": [ { - "name": "1TestNoConfig", - "item": [ - { - "name": "DeleteAllEMAApps", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Delete1 ok EMA\", function () {", - " pm.response.to.have.status(200);", - "", - " ", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/apps/dotema-config-v2/8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "apps", - "dotema-config-v2", - "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" - ] - } - }, - "response": [] - }, - { - "name": "NoConfig", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"User FE has not access to EMA\", function () {", - " pm.response.to.have.status(404);", - "", - " ", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/ema", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "ema" - ] - } - }, - "response": [] - }, + "name": "NoConfig", + "event": [ { - "name": "app-save2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotCMS.com", - "type": "string" - }, - { - "key": "saveHelperData", - "type": "any" - }, - { - "key": "showPassword", - "value": false, - "type": "boolean" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } + "listen": "test", + "script": { + "exec": [ + "pm.test(\"User FE has not access to EMA\", function () {", + " pm.response.to.have.status(404);", + "", + " ", + "});" ], - "body": { - "mode": "raw", - "raw": "{ \n\t \"configuration\": {\n\t\t \"value\": \"{\\r\\n \\\"config\\\":[\\r\\n {\\r\\n \\\"pattern\\\":\\\"\\/blogs\\/(.*)\\\",\\r\\n \\\"url\\\":\\\"https:\\/\\/myspa.blogs.com:3000\\\",\\r\\n \\\"options\\\":{\\r\\n \\\"authenticationToken\\\":\\\"123\\\",\\r\\n \\\"depth\\\":3,\\r\\n \\\"X-CONTENT-APP\\\":\\\"dotCMS\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"pattern\\\":\\\".*\\\",\\r\\n \\\"url\\\":\\\"https:\\/\\/myspa.com:3000\\\",\\r\\n \\\"options\\\":{\\r\\n \\\"authenticationToken\\\":\\\"456\\\",\\r\\n \\\"depth\\\":1,\\r\\n \\\"X-CONTENT-APP\\\":\\\"dotCMS\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\"\n }\n}\n" - }, - "url": { - "raw": "{{serverURL}}/api/v1/apps/dotema-config-v2/8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "apps", - "dotema-config-v2", - "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" - ] - }, - "description": "This tests the endpoint that brings back one specific App/integration given the App-key followed by the site-id" - }, - "response": [] + "type": "text/javascript" + } } - ] - }, - { - "name": "2TestFrontEndAccess", - "item": [ - { - "name": "CreateFrontEndUsers", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"User FE creation sucessfully\", function () {", - " pm.response.to.have.status(200);", - "", - " var jsonData = pm.response.json();", - " console.log(jsonData);", - "", - " pm.expect(jsonData.entity.user[\"emailAddress\"]).to.eql(\"frontend2@dotcms.com\");", - " pm.expect(jsonData.entity.user[\"firstName\"]).to.eql(\"FrontEnd\");", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"userId\":\"userid-fe1-12345678\",\n \"active\":true,\n \"firstName\":\"FrontEnd\",\n \"middleName\":\"F\",\n \"lastName\":\"FE\",\n \"nickName\":\"FE\",\n \"email\":\"frontend2@dotcms.com\",\n \"male\":true,\n \"password\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\"],\n \"roles\":[\"DOTCMS_FRONT_END_USER\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/users", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "users" - ] - } - }, - "response": [] - }, - { - "name": "CallLogout2", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/dotAdmin/logout", - "host": [ - "{{serverURL}}" - ], - "path": [ - "dotAdmin", - "logout" - ] - } - }, - "response": [] - }, - { - "name": "CheckEMAwithFEUserExpectedDenied", - "event": [ + ], + "request": { + "auth": { + "type": "basic", + "basic": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"User FE has not access to EMA\", function () {", - " pm.response.to.have.status(401);", - "", - " ", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "frontend2@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "12345678", - "type": "string" - } - ] + "key": "password", + "value": "admin", + "type": "string" }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/ema", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "ema" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "3TestBeLimitedUser", - "item": [ - { - "name": "CallLogout1", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/dotAdmin/logout", - "host": [ - "{{serverURL}}" - ], - "path": [ - "dotAdmin", - "logout" - ] - } - }, - "response": [] - }, - { - "name": "CreateBELimitedUser", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"User FE creation sucessfully\", function () {", - " pm.response.to.have.status(200);", - "", - " var jsonData = pm.response.json();", - " console.log(jsonData);", - "", - " pm.expect(jsonData.entity.user[\"emailAddress\"]).to.eql(\"backend@dotcms.com\");", - " pm.expect(jsonData.entity.user[\"firstName\"]).to.eql(\"Backend\");", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "admin", - "type": "string" - }, - { - "key": "username", - "value": "admin@dotcms.com", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"userId\":\"userid-be1-12345678\",\n \"active\":true,\n \"firstName\":\"Backend\",\n \"middleName\":\"B\",\n \"lastName\":\"BE\",\n \"nickName\":\"BE\",\n \"email\":\"backend@dotcms.com\",\n \"male\":true,\n \"password\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\"],\n \"roles\":[\"DOTCMS_BACK_END_USER\"]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{serverURL}}/api/v1/users", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "users" - ] - } - }, - "response": [] - }, - { - "name": "CallLogout2", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/dotAdmin/logout", - "host": [ - "{{serverURL}}" - ], - "path": [ - "dotAdmin", - "logout" - ] + "key": "username", + "value": "admin@dotcms.com", + "type": "string" } - }, - "response": [] + ] }, - { - "name": "CheckEMAwithBEUserExpectedSuccess", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"User BE has not access to EMA\", function () {", - " pm.response.to.have.status(200);", - "", - " ", - "});" - ], - "type": "text/javascript" - } - } + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/ema", + "host": [ + "{{serverURL}}" ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "username", - "value": "backend@dotcms.com", - "type": "string" - }, - { - "key": "password", - "value": "12345678", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/api/v1/ema", - "host": [ - "{{serverURL}}" - ], - "path": [ - "api", - "v1", - "ema" - ] - } - }, - "response": [] - }, - { - "name": "CallLogout3", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{serverURL}}/dotAdmin/logout", - "host": [ - "{{serverURL}}" - ], - "path": [ - "dotAdmin", - "logout" - ] - } - }, - "response": [] + "path": [ + "api", + "v1", + "ema" + ] } - ] + }, + "response": [] }, { "name": "app-save1", @@ -554,6 +124,55 @@ "description": "This tests the endpoint that brings back one specific App/integration given the App-key followed by the site-id" }, "response": [] + }, + { + "name": "TestConfig", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Now available the EMA\", function () {", + " pm.response.to.have.status(200);", + "", + " ", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/ema", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "ema" + ] + } + }, + "response": [] } ] } \ No newline at end of file