Commit b8267340 authored by Denis Karpenok (EPAM)'s avatar Denis Karpenok (EPAM)
Browse files

Multiuser POC

parent 3c3f06bf
Pipeline #13133 failed with stages
in 11 seconds
{
"info": {
"_postman_id": "c7da8d07-9e73-4049-82bd-99fcca399016",
"name": "Delivery API CI/CD v1.0",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Configure collection",
"item": [
{
"name": "Refresh Token",
"event": [
{
"listen": "test",
"script": {
"id": "0f218008-1e8a-472f-bbe2-b44914986a0a",
"exec": [
"// this snippet extracts the new access and id tokens",
"// and puts them to environment variables",
"cp = pm.environment.get(\"cloud_platform\");",
"",
"var data = JSON.parse(responseBody)",
"pm.environment.set(\"access_token\", data.access_token);",
"if (cp == \"AWS\") {",
" pm.environment.set(\"id_token\", data.id_token);",
"}",
"// Uncomment if server returns a new refresh_token,",
"// otherwise comment out to prevent overwriting it with null",
"if (cp == \"Azure\") {",
" pm.environment.set(\"refresh_token\", data.refresh_token);",
"}"
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"id": "3f93889e-ba6f-48de-908a-7b522412172e",
"exec": [
"cp = pm.environment.get(\"cloud_platform\");\r",
"\r",
"if (cp == \"GCP\") {\r",
" pm.environment.set(\"Scope\", \"email openid profile\")\r",
"}\r",
"else {\r",
" client_id = pm.environment.get(\"CLIENT_ID\");\r",
" pm.environment.set(\"Scope\", client_id + \"/.default openid profile offline_access\")\r",
"}\r",
"\r",
"function setPermission(groupName) {\r",
" console.log(groupName);\r",
"\r",
"};\r",
"\r",
"pm.globals.set('setPermission', () => {\r",
" console.log(groupName);\r",
"});\r",
"\r",
"//refreshTokenAdmin(pm)\r",
"\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/x-www-form-urlencoded"
},
{
"key": "Ocp-Apim-Subscription-Key",
"type": "text",
"value": "xxxxxxxx",
"disabled": true
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "grant_type",
"value": "refresh_token",
"type": "text"
},
{
"key": "client_id",
"value": "{{CLIENT_ID}}",
"description": "Supply your client id as an environment variable",
"type": "text"
},
{
"key": "client_secret",
"value": "{{CLIENT_SECRET}}",
"description": "Supply your client secret as an environment variable",
"type": "text"
},
{
"key": "refresh_token",
"value": "{{refresh_token}}",
"type": "text"
},
{
"key": "scope",
"value": "{{Scope}}",
"type": "text"
}
],
"options": {
"urlencoded": {}
}
},
"url": {
"raw": "{{Token_Fetch_URL}}",
"host": [
"{{Token_Fetch_URL}}"
]
}
},
"response": []
},
{
"name": "Admin Refresh Token Copy",
"event": [
{
"listen": "test",
"script": {
"id": "a83dfd59-1e44-4778-b91a-1b2be74f4a19",
"exec": [
"// this snippet extracts the new access and id tokens",
"// and puts them to environment variables",
"cp = pm.environment.get(\"cloud_platform\");",
"",
"var data = JSON.parse(responseBody)",
"pm.environment.set(\"ADMIN_ACCESS_TOKEN\", data.access_token);",
"if (cp == \"AWS\") {",
" pm.environment.set(\"id_token\", data.id_token);",
"}",
"// Uncomment if server returns a new refresh_token,",
"// otherwise comment out to prevent overwriting it with null",
"if (cp == \"Azure\") {",
" pm.environment.set(\"refresh_token\", data.refresh_token);",
"}"
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"id": "aae28438-2bea-4755-a6ab-02447a377502",
"exec": [
"cp = pm.environment.get(\"cloud_platform\");\r",
"\r",
"if (cp == \"GCP\") {\r",
" pm.environment.set(\"Scope\", \"email openid profile\")\r",
" }\r",
"else {\r",
" client_id = pm.environment.get(\"CLIENT_ID\");\r",
" pm.environment.set(\"Scope\", client_id + \"/.default openid profile offline_access\")\r",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/x-www-form-urlencoded"
},
{
"key": "Ocp-Apim-Subscription-Key",
"type": "text",
"value": "xxxxxxxx",
"disabled": true
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "grant_type",
"value": "refresh_token",
"type": "text"
},
{
"key": "client_id",
"value": "{{ADMIN_CLIENT_ID}}",
"description": "Supply your client id as an environment variable",
"type": "text"
},
{
"key": "client_secret",
"value": "{{ADMIN_CLIENT_SECRET}}",
"description": "Supply your client secret as an environment variable",
"type": "text"
},
{
"key": "refresh_token",
"value": "{{ADMIN_REFRESH_TOKEN}}",
"type": "text"
},
{
"key": "scope",
"value": "{{Scope}}",
"type": "text"
}
]
},
"url": {
"raw": "{{Token_Fetch_URL}}",
"host": [
"{{Token_Fetch_URL}}"
]
}
},
"response": []
}
],
"protocolProfileBehavior": {}
},
{
"name": "Delivery",
"item": [
{
"name": "C02. Fulltext Search #2 (Wildcard) Copy",
"event": [
{
"listen": "test",
"script": {
"id": "d7c82301-c065-4d2a-b03f-699801a7abea",
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Status description - OK\", function () {\r",
" pm.response.to.have.status(\"OK\");\r",
"});\r",
"\r",
"//get the record count\r",
"try {\r",
" let resBody = pm.response.json();\r",
"\r",
" let recordCount = resBody.totalCount;\r",
" tests[\"Record count: \" + recordCount] = recordCount >= 1;\r",
" }\r",
"catch (e) {\r",
" console.log(e.message);\r",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{access_token}}"
},
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
},
{
"key": "data-partition-id",
"type": "text",
"value": "{{data-partition-id}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"kind\": \"osdu:osdu:welllog-wpc:0.2.0\"\n}\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{SEARCH_HOST}}/query",
"protocol": "https",
"host": [
"{{SEARCH_HOST}}"
],
"path": [
"query"
]
}
},
"response": []
},
{
"name": "01 Delivery - Retrieve the file for the well Log wpc record",
"event": [
{
"listen": "test",
"script": {
"id": "ae0e03d2-82b5-41e2-9d0f-d96f3144d68d",
"exec": [
"// Ensure the API was able to send a successful response",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"",
"// Ensure a signed URL is returned for the file in question. ",
"pm.test(\"Signed URL returned? :\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.processed).to.be.ok;",
" pm.expect(jsonData.unprocessed.length).to.equal(0);",
"});",
"",
"",
""
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"id": "2aae928f-3874-4c83-b71c-bc35babfed1e",
"exec": [
"console.log(globalThis.token)"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
},
{
"key": "data-partition-id",
"type": "text",
"value": "{{data-partition-id}}"
},
{
"key": "accept",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n\t\"srns\" : [ \"srn:file/las2:7011944882696956554:\" ] \r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{DELIVERY_HOST}}",
"protocol": "https",
"host": [
"{{DELIVERY_HOST}}"
]
},
"description": "Retrieve the latest version of one record based on id (SRN), and only return the columns specified in the attributes section of the request"
},
"response": []
},
{
"name": "02 Delivery - Retrieve the file for the wellboreMarker wpc record",
"event": [
{
"listen": "test",
"script": {
"id": "543293b5-bd29-4bc7-b45d-ba7c1e3b46ec",
"exec": [
"// Ensure the API was able to send a successful response",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"",
"// Ensure a signed URL is returned for the file in question. ",
"pm.test(\"Signed URL returned? :\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.processed).to.be.ok;",
" pm.expect(jsonData.unprocessed.length).to.equal(0);",
"});",
"",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
},
{
"key": "data-partition-id",
"type": "text",
"value": "{{data-partition-id}}"
},
{
"key": "accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n\t\"srns\" : [ \"srn:file/csv:33554447243488057924904:\" ] \r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{DELIVERY_HOST}}",
"protocol": "https",
"host": [
"{{DELIVERY_HOST}}"
]
},
"description": "Retrieve the latest version of one record based on id (SRN), and only return the columns specified in the attributes section of the request"
},
"response": []
},
{
"name": "03 Delivery - Retrieve the file for the wellboreTrajectory wpc record",
"event": [
{
"listen": "test",
"script": {
"id": "94eed070-4080-48f4-90b6-077c9ec45ca6",
"exec": [
"// Ensure the API was able to send a successful response",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"",
"// Ensure a signed URL is returned for the file in question. ",
"pm.test(\"Signed URL returned? :\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.processed).to.be.ok;",
" pm.expect(jsonData.unprocessed.length).to.equal(0);",
"});",
"",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
},
{
"key": "data-partition-id",
"type": "text",
"value": "{{data-partition-id}}"
},
{
"key": "accept",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n\t\"srns\" : [ \"srn:file/csv:898844761925351613:\" ] \r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{DELIVERY_HOST}}",
"protocol": "https",
"host": [
"{{DELIVERY_HOST}}"
]
},
"description": "Retrieve the latest version of one record based on id (SRN), and only return the columns specified in the attributes section of the request"
},
"response": []
},
{
"name": "04 Delivery - Retrieve the file for the well Log wpc record without correct permission to access the API",
"event": [
{
"listen": "test",
"script": {
"id": "b311ce6e-073b-4d3b-9e85-7593f1d97483",
"exec": [
"// Ensure the API was able to send a successful response",
"pm.test(\"Status code is 401\", function () {",
" pm.response.to.have.status(401);",
"});",
"",
"",
"",
"",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
},
{
"key": "data-partition-id",
"type": "text",
"value": "{{data-partition-id}}"
},