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

Data-Types collection #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
101 changes: 58 additions & 43 deletions postman_API/Access-Token.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "897bcd45-88d6-41c3-bfc3-6bc08b379dc1",
"_postman_id": "eda73dec-ea31-fe92-ce38-d0dc7fe2b12f",
"name": "Access-Token",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
Expand All @@ -11,32 +11,74 @@
{
"listen": "test",
"script": {
"id": "fbfb3e06-066b-4404-b856-60530483f52c",
"id": "3101a187-1ea6-4842-9fa1-45c4920d9f53",
"type": "text/javascript",
"exec": [
"var data = JSON.parse(responseBody);",
"postman.setEnvironmentVariable(\"access_token\", data.access_token);",
"postman.setEnvironmentVariable(\"refresh_token\", data.refresh_token);",
"postman.setGlobalVariable(\"status_code_ok\", () => {",
" // Status code OK",
" pm.test(\"Status code is 200\", function(){",
" pm.response.to.have.status(200);",
" });",
"});",
"",
"tests[\"Status code is 200\"] = responseCode.code === 200;",
"tests[\"Response time is less than 200ms\"] = responseTime < 200;",
"tests['Access Token is not blank'] = data.access_token !== \"\";",
"tests['Refresh Token is not blank'] = data.refresh_token !== \"\";",
"postman.setGlobalVariable(\"status_code_not_found\", () => {",
" // Status code not found",
" pm.test(\"Status code is 404\", function(){",
" pm.response.to.have.status(404);",
" });",
"});",
"",
"postman.setGlobalVariable(\"status_code_bad_request\", () => {",
" // Status code bad request",
" pm.test(\"Status code is 400\", function(){",
" pm.response.to.have.status(400);",
" });",
"});",
"",
"postman.setGlobalVariable(\"status_code_conflict\", () => {",
" // Status code bad request",
" pm.test(\"Status code is 409\", function(){",
" pm.response.to.have.status(409);",
" });",
"});",
"",
"postman.setGlobalVariable(\"response_time_limit\", () => {",
" // The response time must be less than 200 milliseconds",
" pm.test(\"Response time is less than 200ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(200);",
" });",
"",
"});",
"",
"postman.setGlobalVariable(\"validate_response\", (response) => {",
" var data_type_schema = JSON.parse(environment.data_type_schema);",
" pm.test(\"Response schema is valid\", function(){",
" pm.expect(tv4.validate(data, data_type_schema, true, true)).to.be.true;",
" });",
"});",
"",
"postman.setGlobalVariable(\"is_empty\", (obj) => {",
" for(var prop in obj) {",
" if(obj.hasOwnProperty(prop))",
" return false;",
" }",
" return JSON.stringify(obj) === JSON.stringify({});",
"});",
"",
"eval(globals.status_code_ok)();",
"eval(globals.response_time_limit)();",
"",
"pm.test('Access Token is not blank', function(){",
" pm.expect(data.access_token).to.not.be.eql(\"\");",
"});",
"",
"pm.test('Refresh Token is not blank', function(){",
" pm.expect(data.refresh_token).to.not.be.eql(\"\");",
"});",
"",
""
]
}
},
{
"listen": "prerequest",
"script": {
"id": "28ca9674-96f9-40b8-8feb-2e724de9ff4e",
"type": "text/javascript",
"exec": [
""
]
}
Expand All @@ -56,31 +98,26 @@
{
"key": "username",
"value": "admin",
"description": "",
"type": "text"
},
{
"key": "password",
"value": "adminadmin",
"description": "",
"type": "text"
},
{
"key": "grant_type",
"value": "password",
"description": "",
"type": "text"
},
{
"key": "client_id",
"value": "REST_API",
"description": "",
"type": "text"
},
{
"key": "client_secret",
"value": "REAST_API_SEC",
"description": "",
"type": "text"
}
]
Expand All @@ -99,27 +136,5 @@
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "8cab39a6-d4a2-4447-b651-76c83284188d",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "2d880ebb-d1ed-4a41-af93-fd91103c2000",
"type": "text/javascript",
"exec": [
""
]
}
}
]
}
Loading