Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#29535 Include postman test for the PATCH case #29751

Merged
merged 4 commits into from
Aug 26, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 119 additions & 2 deletions dotcms-postman/src/main/resources/postman/Workflow_Resource_Tests.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"info": {
"_postman_id": "3e3539fd-4915-4514-a0d0-dc1d142a6f7f",
"_postman_id": "2a422520-eec4-42b3-94c3-5126f2691138",
"name": "Workflow Resource Tests [/api/v1/workflows]",
"description": "Test the necesary validations to every end point of the worlflow resource ",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "31066048"
"_exporter_id": "4500400"
},
"item": [
{
Expand Down Expand Up @@ -9126,6 +9126,71 @@
},
"response": []
},
{
"name": "UpdateContent",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200 \", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"",
"",
"pm.test(\"Valid response\", function () {",
" pm.expect(pm.response.text()).to.include(\"SucessRequest\");",
"});",
"",
"var jsonData = pm.response.json();",
"",
"pm.test(\"Key Value updated\", function () {",
" let contentIdentifier = pm.collectionVariables.get(\"contentletIdentifier\");",
" let contentlet = jsonData.entity.results[0][contentIdentifier];",
" pm.expect(contentlet.key).include(\"SucessRequest-Updated\"); ",
" pm.expect(contentlet.value).include(\"SucessRequest-Updated\");",
"});",
"",
"",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{ \"contentlet\" : {\n \"identifier\": \"{{contentletIdentifier}}\", \n \"key\": \"SucessRequest-Updated{{$timestamp}}\",\n \"value\": \"SucessRequest-Updated{{$timestamp}}\"\n}\n}"
},
"url": {
"raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH",
"host": [
"{{serverURL}}"
],
"path": [
"api",
"v1",
"workflow",
"actions",
"default",
"fire",
"PUBLISH"
]
},
"description": "Updates content fields \"key\" and \"value\" by using the PATCH verb.\n\nAsserts the fields \"key\" and \"value\" were effectively updated."
},
"response": []
},
{
"name": "Fire Publish BaseType Can Not Be Resolved BadRequest",
"event": [
Expand Down Expand Up @@ -17413,6 +17478,46 @@
"script": {
"type": "text/javascript",
"exec": [
"if (!pm.environment.get('jwt')) {",
" console.log(\"generating....\")",
" 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 (!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);",
" }",
" });",
" }",
"}",
""
]
}
Expand Down Expand Up @@ -17451,6 +17556,18 @@
{
"key": "temporalFileOneId",
"value": ""
},
{
"key": "contentletIdentifier",
"value": ""
},
{
"key": "contentletInode",
"value": ""
},
{
"key": "fireActionLanguageKey",
"value": ""
}
]
}
Loading