From 80f69cbd7546733041deda3d02bbf8c99c4de00e Mon Sep 17 00:00:00 2001 From: osipovartem Date: Fri, 25 Oct 2024 19:06:23 +0300 Subject: [PATCH] Add postman collection --- .../ui_endpoints.postman_collection.json | 706 ++++++++++++++++++ 1 file changed, 706 insertions(+) create mode 100644 crates/nexus/src/tests/ui_endpoints.postman_collection.json diff --git a/crates/nexus/src/tests/ui_endpoints.postman_collection.json b/crates/nexus/src/tests/ui_endpoints.postman_collection.json new file mode 100644 index 000000000..3158b62e9 --- /dev/null +++ b/crates/nexus/src/tests/ui_endpoints.postman_collection.json @@ -0,0 +1,706 @@ +{ + "info": { + "_postman_id": "e4830234-355b-47d0-b846-e5989ec251a4", + "name": "End-to-End Tests", + "description": "> This collection features end-to-end tests that ensure the Intergalactic Bank API components function in an expected sequence. Check out the [Functional testing collection](https://www.postman.com/templates/f26ad070-d626-4d75-b151-7cbf1a48ed11/Functional-testing) and [Integration testing collection](https://www.postman.com/templates/6f788c17-067a-4074-a528-d07df1df9529/Integration-testing-%23example) for other test cases for this API. \n \n\n## **🪐 Get started**\n\nThe fictional Intergalactic Bank Services team is responsible for testing the end-to-end workflows in this collection. You can use this collection to validate specific workflows for your team or figure out ways to increase your test coverage and make your applications more resilient.\n\nTo test the Intergalactic Bank API, you can:\n\n1. **Review tests and scripts:** Check out the [tests](https://learning.postman.com/docs/writing-scripts/test-scripts/) in the Scripts tab of a collection, folder, or request. You’ll also find additional steps in the Pre-request Script, such as for passing data between requests or building up POST request payloads.\n \n2. **Run tests:** To run the collection, select Run collection from the collection menu. If you are interested in testing one of the use cases, select Run folder from the use case folder menu. Keep in mind that many of these tests contain logic that passes information between requests, and they are meant to be run in order from top to bottom. If you send the requests manually or out of order, your results may vary.\n \n3. **Review test results:** Many of the test cases contain error messages to help debug service errors. If you’re using this collection as a pre-merge check, ensure that all tests are passing before submitting (and no, deleting the failing test cases isn’t an option 😉).\n \n\nCheck out the additional sections below or select View complete documentation. For context-sensitive help with a folder or request, look for the documentation icon.\n\n## 🧑‍💻How your team can use this collection\n\n- **Add a mock server to speed up development:** Adding functionality to this service? Since this collection has example responses, you can add a mock server that will return the expected results. Start writing tests against the mock, and once your additions are live, you can swap out the URLs and have a live test suite.\n \n- **Integrate tests with your CI/CD pipeline:** This comprehensive test suite is a great addition to your existing CI/CD pipeline. Generate the Postman CLI command from the Collection Runner and add this step to your existing checks each time you make a commit affecting this service.\n \n- **Add a monitor:** If your team is contributing to or relying on this service, it’s a good idea to keep tabs on the status. Adding a monitor to this collection can give you confidence that the service is up and running and alert you to any breaking changes that may have occurred.\n \n\n## 🔍 What we’re testing\n\n- A very common workflow is the transfer of funds between accounts. We have two scenarios: one which creates all resources and successfully transfers funds, and one which tries the transfer with insufficient funds.\n \n- During these workflows, we are testing for data correctness, data types, and that data is successfully passed through the system during creation and retrieval.\n \n\n## 🔒A note on authorization\n\nThis API uses an API key-based authorization. In this collection, we set the authorization at the collection level and generate a new API Key for each test run.\n\n## 👀 View and share run results\n\nInterested in seeing previous run results? We’re happy to share, and have a few ways for you to stay in the loop:\n\n- **Runs tab:** View past collection runs in the `Runs` tab of this collection. Here, you can see the results of past runs, including who ran them and whether it was via the Collection Runner or the CLI. You can also share individual run reports from this page.\n \n- **Monitors:** If you have a monitor set up for this collection, you can see historical run information when you select the Monitors tab in the left sidebar. You can also have the results sent to Slack or other services when you set up a corresponding integration.\n \n\n### 🤝Increase test coverage\n\nThe Intergalactic Bank Services team wants your team to have everything they need to successfully test our services with their applications. Is your team utilizing this API in a use case not represented here? Reach out to us on our internal Slack by tagging `@bank-services`. Or add an [inline comment](https://learning.postman.com/docs/collaborating-in-postman/working-with-your-team/discussing-your-work/) to this collection with your test case suggestions.", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "39228746" + }, + "item": [ + { + "name": "Process a VALID transaction", + "item": [ + { + "name": "Create storage-profile", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Successful POST request\", function () {", + " pm.expect(pm.response.code).to.be.oneOf([200, 201]);", + " pm.collectionVariables.set(\"storage_profile_id\", pm.response.json().id)", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"bucket\": \"artem_test\",\n \"credentials\": {\n \"aws_access_key_id\": \"123\",\n \"aws_secret_access_key\": \"123\"\n },\n \"region\": \"us-east-2\",\n \"endpoint\": \"\",\n \"sts_role_arn\": \"\",\n \"type\": \"aws\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{rust_url}}/ui/storage-profiles", + "host": [ + "{{rust_url}}" + ], + "path": [ + "ui", + "storage-profiles" + ] + }, + "description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\n\nA successful POST request typically returns a `200 OK` or `201 Created` response code." + }, + "response": [] + }, + { + "name": "Get storage-profile", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{base_url}}/info?id=1", + "host": [ + "{{base_url}}" + ], + "path": [ + "info" + ], + "query": [ + { + "key": "id", + "value": "1" + } + ] + }, + "description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data." + }, + "response": [] + }, + { + "name": "Get storage-profile error", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{base_url}}/info?id=1", + "host": [ + "{{base_url}}" + ], + "path": [ + "info" + ], + "query": [ + { + "key": "id", + "value": "1" + } + ] + }, + "description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data." + }, + "response": [] + }, + { + "name": "Get storage-profiles", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{base_url}}/info?id=1", + "host": [ + "{{base_url}}" + ], + "path": [ + "info" + ], + "query": [ + { + "key": "id", + "value": "1" + } + ] + }, + "description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data." + }, + "response": [] + }, + { + "name": "Navigation", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{base_url}}/info?id=1", + "host": [ + "{{base_url}}" + ], + "path": [ + "info" + ], + "query": [ + { + "key": "id", + "value": "1" + } + ] + }, + "description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data." + }, + "response": [] + }, + { + "name": "Create warehouse", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Successful POST request\", function () {", + " pm.expect(pm.response.code).to.be.oneOf([200, 201]);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"bucket\": \"artem_test\",\n \"credentials\": {\n \"aacess_key\": {\n \"aws_access_key_id\": \"123\",\n \"aws_secret_access_key\": \"123\"\n }\n\n },\n \"region\": \"us-east-2\",\n \"endpoint\": \"\",\n \"sts_role_arn\": \"\",\n \"type\": \"aws\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://0.0.0.0:3000/ui/storage-profiles", + "protocol": "http", + "host": [ + "0", + "0", + "0", + "0" + ], + "port": "3000", + "path": [ + "ui", + "storage-profiles" + ] + }, + "description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\n\nA successful POST request typically returns a `200 OK` or `201 Created` response code." + }, + "response": [] + }, + { + "name": "Create warehouse error", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Successful POST request\", function () {", + " pm.expect(pm.response.code).to.be.oneOf([200, 201]);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"bucket\": \"artem_test\",\n \"credentials\": {\n \"aacess_key\": {\n \"aws_access_key_id\": \"123\",\n \"aws_secret_access_key\": \"123\"\n }\n\n },\n \"region\": \"us-east-2\",\n \"endpoint\": \"\",\n \"sts_role_arn\": \"\",\n \"type\": \"aws\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://0.0.0.0:3000/ui/storage-profiles", + "protocol": "http", + "host": [ + "0", + "0", + "0", + "0" + ], + "port": "3000", + "path": [ + "ui", + "storage-profiles" + ] + }, + "description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\n\nA successful POST request typically returns a `200 OK` or `201 Created` response code." + }, + "response": [] + }, + { + "name": "Get warehouses", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{base_url}}/info?id=1", + "host": [ + "{{base_url}}" + ], + "path": [ + "info" + ], + "query": [ + { + "key": "id", + "value": "1" + } + ] + }, + "description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data." + }, + "response": [] + }, + { + "name": "Get warehouse", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{base_url}}/info?id=1", + "host": [ + "{{base_url}}" + ], + "path": [ + "info" + ], + "query": [ + { + "key": "id", + "value": "1" + } + ] + }, + "description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data." + }, + "response": [] + }, + { + "name": "Create database", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Successful POST request\", function () {", + " pm.expect(pm.response.code).to.be.oneOf([200, 201]);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": " { \n \"warehouse_id\": \"0c648454-00fe-44a9-a729-270c3e000cff\",\n \"name\": \"name\",\n \"properties\" : {\"test\": \"eqqq\"}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://0.0.0.0:3000/ui/warehouses/b548baed-66b7-48b7-8fcd-3eff003e89c8/databases", + "protocol": "http", + "host": [ + "0", + "0", + "0", + "0" + ], + "port": "3000", + "path": [ + "ui", + "warehouses", + "b548baed-66b7-48b7-8fcd-3eff003e89c8", + "databases" + ] + }, + "description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\n\nA successful POST request typically returns a `200 OK` or `201 Created` response code." + }, + "response": [] + }, + { + "name": "Get database", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{base_url}}/info?id=1", + "host": [ + "{{base_url}}" + ], + "path": [ + "info" + ], + "query": [ + { + "key": "id", + "value": "1" + } + ] + }, + "description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data." + }, + "response": [] + }, + { + "name": "Get database error", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{base_url}}/info?id=1", + "host": [ + "{{base_url}}" + ], + "path": [ + "info" + ], + "query": [ + { + "key": "id", + "value": "1" + } + ] + }, + "description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data." + }, + "response": [] + }, + { + "name": "Create table", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Successful POST request\", function () {", + " pm.expect(pm.response.code).to.be.oneOf([200, 201]);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": " { \n \"warehouse_id\": \"0c648454-00fe-44a9-a729-270c3e000cff\",\n \"name\": \"name\",\n \"properties\" : {\"test\": \"eqqq\"}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://0.0.0.0:3000/ui/warehouses/b548baed-66b7-48b7-8fcd-3eff003e89c8/databases", + "protocol": "http", + "host": [ + "0", + "0", + "0", + "0" + ], + "port": "3000", + "path": [ + "ui", + "warehouses", + "b548baed-66b7-48b7-8fcd-3eff003e89c8", + "databases" + ] + }, + "description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\n\nA successful POST request typically returns a `200 OK` or `201 Created` response code." + }, + "response": [] + }, + { + "name": "Get table", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Successful POST request\", function () {", + " pm.expect(pm.response.code).to.be.oneOf([200, 201]);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": " { \n \"warehouse_id\": \"0c648454-00fe-44a9-a729-270c3e000cff\",\n \"name\": \"name\",\n \"properties\" : {\"test\": \"eqqq\"}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://0.0.0.0:3000/ui/warehouses/b548baed-66b7-48b7-8fcd-3eff003e89c8/databases", + "protocol": "http", + "host": [ + "0", + "0", + "0", + "0" + ], + "port": "3000", + "path": [ + "ui", + "warehouses", + "b548baed-66b7-48b7-8fcd-3eff003e89c8", + "databases" + ] + }, + "description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\n\nA successful POST request typically returns a `200 OK` or `201 Created` response code." + }, + "response": [] + } + ], + "description": "This folder tests a commonly used workflow of creating new accounts and transferring funds between the two.\n\nBecause we expect all requests to succeed in this workflow, we have a **status check test** in the **folder-level Scripts tab**.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "//all requests in this folder should be valid", + "pm.test(\"Folder-level status check\", function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + } + ], + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "key", + "value": "api-key", + "type": "string" + }, + { + "key": "value", + "value": "{{apiKey}}", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "baseUrl", + "value": "https://template.postman-echo.com", + "type": "string" + }, + { + "key": "apiKey", + "value": "OMpqVWAH.UC80wyXTtPwhDgAUdCTx6" + }, + { + "key": "storage_profile_id", + "value": "" + }, + { + "key": "sp_id", + "value": "" + }, + { + "key": "wh_id", + "value": "" + }, + { + "key": "db_id", + "value": "" + }, + { + "key": "db_name", + "value": "" + }, + { + "key": "table_name", + "value": "" + } + ] +} \ No newline at end of file