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

Update Permission_Resource.postman_collection.json #26947

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Changes from all 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
63 changes: 60 additions & 3 deletions dotCMS/src/curl-test/Permission_Resource.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@
"pm.collectionVariables.set(\"ownerRoles\", roles[2].id);",
"pm.collectionVariables.set(\"ldapUserRoles\", roles[3].id);",
"pm.collectionVariables.set(\"loginAsRoles\", roles[4].id);",
"",
"pm.test(\"All IDs are unique\", function () {",
" // Get all IDs from the response",
" const ids = pm.response.json().entity.map(entity => entity.id);",
"",
" // Convert the array of IDs to a Set to eliminate duplicates",
" const uniqueIds = new Set(ids);",
"",
" // Check if the length of the unique IDs set is equal to the original array",
" pm.expect(uniqueIds.size).to.equal(ids.length);",
"});",
"",
""
],
"type": "text/javascript"
Expand Down Expand Up @@ -91,7 +103,34 @@
"});",
"pm.test(\"Icon should be 360\", function() {",
" pm.expect(contentType.icon).to.eql(\"360\");",
"});"
"});",
"",
"pm.test(\"Content type fields have expected structure\", function () {",
" const createdContentType = pm.response.json().entity[0];",
" const fields = createdContentType.fields;",
"",
" fields.forEach(field => {",
" pm.expect(field).to.have.property(\"clazz\");",
" pm.expect(field).to.have.property(\"contentTypeId\");",
" pm.expect(field).to.have.property(\"dataType\");",
" pm.expect(field).to.have.property(\"fieldType\");",
" pm.expect(field).to.have.property(\"fieldTypeLabel\");",
" // ... Add similar checks for other field properties",
" });",
"});",
"",
"pm.test(\"Content type has required fields\", function () {",
" const createdContentType = pm.response.json().entity[0];",
" const fields = createdContentType.fields;",
"",
" // Check for specific field names and properties",
" pm.expect(fields.some(field => field.name === \"Title\")).to.be.true;",
" pm.expect(fields.find(field => field.name === \"Title\").dataType).to.equal(\"TEXT\");",
"",
" // ... Add similar checks for other fields",
"});",
"",
""
],
"type": "text/javascript"
}
Expand Down Expand Up @@ -275,7 +314,25 @@
" pm.expect(perm.type).to.eql(\"com.dotmarketing.portlets.contentlet.model.Contentlet\");",
" pm.expect(perm.roldId).not.eql(null);",
"});",
""
"",
"pm.test(\"Each permission object has required properties\", function () {",
" const permissions = pm.response.json().entity;",
"",
" permissions.forEach(permission => {",
" pm.expect(permission).to.have.property(\"permission\");",
" pm.expect(permission).to.have.property(\"roleId\");",
" });",
"});",
"",
"// Check for sensitive data exposure (customize as per your API response)",
"pm.test(\"No Sensitive Data Exposure\", function () {",
" var sensitiveFields = [\"password\", \"token\", \"secret\"]; // Add fields to check for sensitivity",
" var jsonData = pm.response.json();",
"",
" sensitiveFields.forEach(function (field) {",
" pm.expect(jsonData.entity[field]).to.not.be.ok;",
" });",
"});"
],
"type": "text/javascript"
}
Expand Down Expand Up @@ -1025,4 +1082,4 @@
"value": ""
}
]
}
}