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

GCP Scope Example

parent 8feae28f
{
"info": {
"_postman_id": "b76af80b-7ef1-42b1-b443-25bbe72dfb76",
"_postman_id": "82e9393b-123a-42de-856f-ef03149bbb1a",
"name": "Delivery API CI/CD v1.0",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
......@@ -14,7 +14,7 @@
{
"listen": "test",
"script": {
"id": "d19b4b18-f475-42d8-9d8f-e81c7f0ab103",
"id": "46a6874f-23db-4694-a0ad-e73d271c8983",
"exec": [
"// this snippet extracts the new access and id tokens",
"// and puts them to environment variables",
......@@ -37,9 +37,17 @@
{
"listen": "prerequest",
"script": {
"id": "9d9ca15b-e512-4261-bd1a-550f91e9714f",
"id": "d0c4a826-531d-4776-b551-50113f67b3b9",
"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"
}
......@@ -91,7 +99,7 @@
},
{
"key": "scope",
"value": "{{CLIENT_ID}}/.default openid profile offline_access",
"value": "{{Scope}}",
"type": "text"
}
],
......@@ -120,7 +128,7 @@
{
"listen": "test",
"script": {
"id": "aedd1dcc-5038-4f91-b32b-7b01ec4daf03",
"id": "f7bcdcf6-7a8b-4486-b707-51144fe71d4a",
"exec": [
"// Ensure the API was able to send a successful response",
"pm.test(\"Status code is 200\", function () {",
......@@ -188,7 +196,7 @@
{
"listen": "test",
"script": {
"id": "10f6bd27-de9c-4825-b67c-508d2f5f82d8",
"id": "9247865f-9a13-431e-ad57-f4f044ffa0ea",
"exec": [
"// Ensure the API was able to send a successful response",
"pm.test(\"Status code is 200\", function () {",
......@@ -256,7 +264,7 @@
{
"listen": "test",
"script": {
"id": "afd40ad7-db71-4b63-83ba-faf88587a002",
"id": "20b6d38e-6a46-412b-aac5-6eb93ba339a5",
"exec": [
"// Ensure the API was able to send a successful response",
"pm.test(\"Status code is 200\", function () {",
......@@ -324,7 +332,7 @@
{
"listen": "test",
"script": {
"id": "c928b61b-3a53-4885-82cc-6b49dd4700ac",
"id": "d169e6a6-50f0-4054-9a32-7d7736c7fb1a",
"exec": [
"// Ensure the API was able to send a successful response",
"pm.test(\"Status code is 401\", function () {",
......@@ -387,7 +395,7 @@
{
"listen": "test",
"script": {
"id": "533a61cb-0e89-44fd-b95e-1013642eda3b",
"id": "4dcffe8c-7ca1-4487-9eab-03d86f5ca10f",
"exec": [
"// Ensure the API was able to send a successful response",
"pm.test(\"Status code is 403\", function () {",
......@@ -462,7 +470,7 @@
{
"listen": "prerequest",
"script": {
"id": "f13108d4-148c-40a7-99c5-61b5ca6307a2",
"id": "36c5f29b-7356-4e2a-81f8-98d26f61ba32",
"type": "text/javascript",
"exec": [
""
......@@ -472,7 +480,7 @@
{
"listen": "test",
"script": {
"id": "abb83f8e-b700-4cb9-a1aa-552fec095f7d",
"id": "d8cab99d-310b-460c-879b-0c4b5a625d2c",
"type": "text/javascript",
"exec": [
""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment