Skip to content

Commit

Permalink
chore: P4ADEV-1277-postman-test-activity (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
macacia authored Oct 22, 2024
1 parent ec2dfc9 commit 21e3707
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions postman/p4pa-auth-E2E.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,9 @@
" pm.expect(jsonResponse).to.have.property(\"clientName\").to.eq(\"testClient\");\r",
" pm.expect(jsonResponse).to.have.property(\"organizationIpaCode\").to.eq(\"IPA_TEST\");\r",
" pm.expect(jsonResponse).to.have.property(\"clientSecret\");\r",
"\r",
" pm.environment.set(\"clientId\", jsonResponse.clientId)\r",
" pm.environment.set(\"clientSecret\", jsonResponse.clientSecret)\r",
" } else {\r",
" // Se il record esiste, ritorna un errore di chiave duplicata\r",
" pm.response.to.have.status(500);\r",
Expand Down Expand Up @@ -997,6 +1000,77 @@
}
},
"response": []
},
{
"name": "postToken client-credentials",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
" pm.environment.get(\"clientId\")\r",
" pm.environment.get(\"clientSecret\")"
],
"type": "text/javascript",
"packages": {}
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Auth - postToken - Responses with 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"pm.test(\"Auth - postToken - Verify response body\", function () {\r",
" let jsonResponse = pm.response.json();\r",
" pm.expect(jsonResponse).have.property(\"tokenType\").to.eq(\"bearer\");\r",
" pm.expect(jsonResponse).have.property(\"expiresIn\").to.eq(14400);\r",
" pm.expect(jsonResponse).have.property(\"accessToken\");\r",
"\r",
" pm.variables.set(\"accessToken\", jsonResponse.accessToken)\r",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{p4paAuthBaseUrl}}/payhub/auth/token?client_id={{clientId}}&grant_type=client_credentials&scope=openid&client_secret={{clientSecret}}",
"host": [
"{{p4paAuthBaseUrl}}"
],
"path": [
"payhub",
"auth",
"token"
],
"query": [
{
"key": "client_id",
"value": "{{clientId}}"
},
{
"key": "grant_type",
"value": "client_credentials"
},
{
"key": "scope",
"value": "openid"
},
{
"key": "client_secret",
"value": "{{clientSecret}}"
}
]
}
},
"response": []
}
],
"event": [
Expand Down

0 comments on commit 21e3707

Please sign in to comment.