From 67d853431ac8b39a2335ec955d5eb061e8e1ee48 Mon Sep 17 00:00:00 2001 From: Anil Gupta Date: Fri, 27 Oct 2023 11:15:49 +0530 Subject: [PATCH] Issue #LR-583 merge: release-5.4.0 to master (#587) --- .circleci/config.yml | 2 +- .gitignore | 1 + Dockerfile.Build | 2 +- Jenkinsfile | 2 +- .../Lms_APIs Test.postman_collection.json | 6555 +++++++++++++++++ .../Lms_APIs.postman_collection.json | 2211 ++++++ .../Lms_Environment.postman_environment.json | 109 + auto_build_deploy | 2 +- .../cacheloader/PageCacheLoaderService.java | 4 +- .../dao/impl/BulkUploadProcessDaoImpl.java | 10 +- .../qrcodedownload/QRCodeDownloadManager.java | 5 +- .../learner/util/DataCacheHandler.java | 9 +- .../java/org/sunbird/learner/util/Util.java | 37 +- .../sunbird/cache/util/RedisCacheUtil.scala | 9 +- .../sunbird/redis/RedisConnectionManager.java | 6 +- .../cassandraimpl/CassandraDACImplTest.java | 9 +- .../sunbird-platform-core/common-util/pom.xml | 17 +- .../sunbird/common/models/util/JsonKey.java | 15 + .../common/models/util/ProjectUtil.java | 37 +- .../common/models/util/TableNameUtil.java | 20 + .../common/models/util/url/EsConfigUtil.java | 15 + .../sunbird/common/util/CloudStorageUtil.java | 43 +- .../resources/externalresource.properties | 21 +- .../common/models/util/ProjectUtilTest.java | 5 - service/dependency-reduced-pom.xml | 2 +- 25 files changed, 9031 insertions(+), 117 deletions(-) create mode 100644 api-tests/Collection/Lms_APIs Test.postman_collection.json create mode 100644 api-tests/Collection/Lms_APIs.postman_collection.json create mode 100644 api-tests/Collection/Lms_Environment.postman_environment.json create mode 100644 course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/TableNameUtil.java create mode 100644 course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/url/EsConfigUtil.java diff --git a/.circleci/config.yml b/.circleci/config.yml index 33849763f..93b855950 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ jobs: - run: name: redis command: sudo apt install redis-server -y - - run: mvn clean install -DforkCount=1 -e + - run: mvn clean install -DCLOUD_STORE_GROUP_ID=$CLOUD_STORE_GROUP_ID -DCLOUD_STORE_ARTIFACT_ID=$CLOUD_STORE_ARTIFACT_ID -DCLOUD_STORE_VERSION=$CLOUD_STORE_VERSION - run: cd course-mw/enrolment-actor && mvn scoverage:report - run: cd course-mw/sunbird-util/cache-utils && mvn scoverage:report - run: cd service && mvn play2:dist diff --git a/.gitignore b/.gitignore index 683ea4bb6..32d6ebdd8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ RUNNING_PID /.target/ /bin/ /logs +**.vscode \ No newline at end of file diff --git a/Dockerfile.Build b/Dockerfile.Build index 245be1eaf..c46fe46d0 100644 --- a/Dockerfile.Build +++ b/Dockerfile.Build @@ -10,6 +10,6 @@ ENV M2_HOME /opt/apache-maven-3.3.9 ENV PATH ${M2_HOME}/bin:${PATH} COPY learner /opt/learner/ WORKDIR /opt/learner/services -RUN mvn clean install -DskipTests +RUN mvn clean install -DskipTests -DCLOUD_STORE_GROUP_ID=org.sunbird -DCLOUD_STORE_ARTIFACT_ID=cloud-store-sdk -DCLOUD_STORE_VERSION=1.4.6 WORKDIR /opt/learner/services/learning-service CMD ["mvn", "play2:dist"] \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 02f044ffa..3f3e30e00 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ node('build-slave') { env.NODE_ENV = "build" print "Environment will be : ${env.NODE_ENV}" sh 'git log -1' - sh 'mvn clean install -DskipTests=true ' + sh "mvn clean install -DskipTests=true -DCLOUD_STORE_GROUP_ID=${params.cloud_store_group_id} -DCLOUD_STORE_ARTIFACT_ID=${params.cloud_store_artifact_id} -DCLOUD_STORE_VERSION=${params.cloud_store_version}" } // stage('Unit Tests') { diff --git a/api-tests/Collection/Lms_APIs Test.postman_collection.json b/api-tests/Collection/Lms_APIs Test.postman_collection.json new file mode 100644 index 000000000..2ea14b4ba --- /dev/null +++ b/api-tests/Collection/Lms_APIs Test.postman_collection.json @@ -0,0 +1,6555 @@ +{ + "info": { + "_postman_id": "0cac8b9b-6c98-4ef0-8ce7-a715b5adf768", + "name": "Lms_APIs Test", + "description": "The LMS APIs is a collection of API's for creation and management of batches,enrollment to the courses,content state related APIs,Aggregation Apis with automated test cases.", + "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json", + "_exporter_id": "4875988", + "_collection_link": "https://dark-star-147860.postman.co/workspace/LernBBAPIs~32e17cc4-6806-407e-b8ef-485ad4d0b712/collection/4875988-0cac8b9b-6c98-4ef0-8ce7-a715b5adf768?action=share&source=collection_link&creator=4875988" + }, + "item": [ + { + "name": "HealthCheck", + "item": [ + { + "name": "HealthCheck", + "request": { + "method": "GET", + "header": [], + "url": "{{host}}/health" + }, + "response": [] + } + ] + }, + { + "name": "AuthToken", + "item": [ + { + "name": "UserToken", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Set global variable", + "// pm.variables.set('refresh_token', jsonResponse.refresh_token);", + "// pm.globals.set(\"refresh_token\", jsonResponse.result.identifier);", + "pm.collectionVariables.set(\"refresh_token\", jsonResponse.refresh_token);", + "// pm.collectionVariables.set(\"variable_key\", \"variable_value\");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + }, + { + "key": "Cookie", + "value": "connect.sid=s%3Ad3chYLP8OfuB2bWgfEFohiWpDxM7GFol.gOPmzH3d2nP9enZ5qSHlVx1e%2BozTleCjXtfz7LUycCk" + } + ], + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "client_id", + "value": "{{auth_client_id}}", + "type": "text" + }, + { + "key": "client_secret", + "value": "{{auth_client_secret}}", + "type": "text" + }, + { + "key": "grant_type", + "value": "password", + "type": "text" + }, + { + "key": "username", + "value": "{{username}}", + "type": "text" + }, + { + "key": "password", + "value": "{{password}}", + "type": "text" + } + ] + }, + "url": "{{host}}/auth/realms/sunbird/protocol/openid-connect/token" + }, + "response": [] + }, + { + "name": "RefreshToken", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Extract the locationId from the response and set it to the environment variable", + "pm.test(\"Set access_token in environment variable\", function () {", + " const responseJson = pm.response.json();", + " pm.environment.set(\"keycloak_access_token\", responseJson.result.access_token);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + }, + { + "key": "Cookie", + "value": "connect.sid=s%3Ad3chYLP8OfuB2bWgfEFohiWpDxM7GFol.gOPmzH3d2nP9enZ5qSHlVx1e%2BozTleCjXtfz7LUycCk" + } + ], + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "refresh_token", + "value": "{{refresh_token}}", + "type": "text" + } + ] + }, + "url": "{{host}}/auth/v1/refresh/token" + }, + "response": [] + } + ] + }, + { + "name": "BatchAPIs", + "item": [ + { + "name": "BatchCreation", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum input value", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Extract the batchId from the response and set it to the environment variable", + "pm.test(\"Set batchId in environment variable\", function () {", + " const responseJson = pm.response.json();", + " console.log( responseJson.result.batchId)", + " pm.environment.set(\"batch_id\", responseJson.result.batchId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_start_date}}\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/create" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "400 - missing enrollmentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"MANDATORY_PARAMETER_MISSING\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "pm.test(\"params.errmsg should be \\\"Mandatory parameter enrollmentType is missing.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter enrollmentType is missing.\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\"\n }\n}" + }, + "url": "https://dev.sunbirded.org/api/course/v1/batch/create" + }, + "response": [] + }, + { + "name": "400 - missing startDate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"MANDATORY_PARAMETER_MISSING\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "pm.test(\"params.errmsg should be \\\"Mandatory parameter startDate is missing.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter startDate is missing.\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"endDate\": \"{{batch_end_date}}\"\n }\n}" + }, + "url": "https://dev.sunbirded.org/api/course/v1/batch/create" + }, + "response": [] + }, + { + "name": "400 - missing courseId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"MANDATORY_PARAMETER_MISSING\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "pm.test(\"params.errmsg should be \\\"Mandatory parameter courseId/collectionId is missing.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter courseId/collectionId is missing.\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"endDate\": \"{{batch_end_date}}\"\n }\n}" + }, + "url": "https://dev.sunbirded.org/api/course/v1/batch/create" + }, + "response": [] + }, + { + "name": "400 - missing batch name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"MANDATORY_PARAMETER_MISSING\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "pm.test(\"params.errmsg should be \\\"Mandatory parameter name is missing.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter name is missing.\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_start_date}}\",\n \"endDate\": \"{{batch_end_date}}\"\n }\n}" + }, + "url": "https://dev.sunbirded.org/api/course/v1/batch/create" + }, + "response": [] + }, + { + "name": "400 - invalid date format", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"DATE_FORMAT_ERRROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"DATE_FORMAT_ERRROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Date format error.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Date format error.\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"05/09/2023\",\n \"endDate\": \"{{batch_end_date}}\"\n }\n}" + }, + "url": "https://dev.sunbirded.org/api/course/v1/batch/create" + }, + "response": [] + }, + { + "name": "400 - invalid enrollmentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"INVALID_PARAMETER_VALUE\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"INVALID_PARAMETER_VALUE\");", + "});", + "pm.test(\"params.errmsg should be \\\"Invalid value join for parameter enrollmentType. Please provide a valid value.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Invalid value join for parameter enrollmentType. Please provide a valid value.\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"join\",\n \"startDate\": \"{{batch_start_date}}\",\n \"endDate\": \"{{batch_end_date}}\"\n }\n}" + }, + "url": "https://dev.sunbirded.org/api/course/v1/batch/create" + }, + "response": [] + }, + { + "name": "400 - invalid endDate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"END_DATE_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"END_DATE_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"End date should be greater than start date.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"End date should be greater than start date.\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_start_date}}\",\n \"endDate\": \"2023-04-01\"\n }\n}" + }, + "url": "https://dev.sunbirded.org/api/course/v1/batch/create" + }, + "response": [] + }, + { + "name": "400 - invalid startDate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"COURSE_BATCH_START_DATE_INVALID\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"COURSE_BATCH_START_DATE_INVALID\");", + "});", + "pm.test(\"params.errmsg should be \\\"Batch start date should be either today or future date.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Batch start date should be either today or future date.\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"2023-01-01\",\n \"endDate\": \"{{batch_end_date}}\"\n }\n}" + }, + "url": "https://dev.sunbirded.org/api/course/v1/batch/create" + }, + "response": [] + } + ] + } + ] + }, + { + "name": "BatchUpdation", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum input value", + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "**Accept** relates to content-Type such as **\"MIME\"**, Its used in response body for executing different multi purpose operations.Therefore, its important that the server is correctly set up, so that the MIME types transmitted are recognised and correct to determine what action to do when a resource is fetched." + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "Time Stamp at which **Update a batch** request was sent." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"status\": 1,\n \"courseId\": \"{{course_id}}\",\n \"id\": \"{{batch_id}}\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "400 - Invalid course batch id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"INVALID_COURSE_BATCH_ID\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"INVALID_COURSE_BATCH_ID\");", + "});", + "pm.test(\"params.errmsg should be \\\"Invalid course batch id \\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Invalid course batch id \");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "**Accept** relates to content-Type such as **\"MIME\"**, Its used in response body for executing different multi purpose operations.Therefore, its important that the server is correctly set up, so that the MIME types transmitted are recognised and correct to determine what action to do when a resource is fetched." + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "Time Stamp at which **Update a batch** request was sent." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_update_date}}\",\n \"enrollmentEndDate\": \"{{batch_end_date}}\",\n \"status\": 1,\n \"courseId\": \"{{course_id}}\",\n \"id\": \"01377666464491929614\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [] + }, + { + "name": "400 - Missing Batch Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"MANDATORY_PARAMETER_MISSING\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "pm.test(\"params.errmsg should be \\\"Mandatory parameter id is missing.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter id is missing.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "**Accept** relates to content-Type such as **\"MIME\"**, Its used in response body for executing different multi purpose operations.Therefore, its important that the server is correctly set up, so that the MIME types transmitted are recognised and correct to determine what action to do when a resource is fetched." + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "Time Stamp at which **Update a batch** request was sent." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_update_date}}\",\n \"enrollmentEndDate\": \"{{batch_end_date}}\",\n \"status\": 1,\n \"courseId\": \"{{course_id}}\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [] + }, + { + "name": "400 - Missing Course Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"MANDATORY_PARAMETER_MISSING\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "pm.test(\"params.errmsg should be \\\"Mandatory parameter courseId/collectionId is missing.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter courseId/collectionId is missing.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "**Accept** relates to content-Type such as **\"MIME\"**, Its used in response body for executing different multi purpose operations.Therefore, its important that the server is correctly set up, so that the MIME types transmitted are recognised and correct to determine what action to do when a resource is fetched." + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "Time Stamp at which **Update a batch** request was sent." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_update_date}}\",\n \"enrollmentEndDate\": \"{{batch_end_date}}\",\n \"status\": 1,\n \"id\": \"01377666464491929614\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [] + }, + { + "name": "400 - Invalid status", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"INVALID_PROGRESS_STATUS\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"INVALID_PROGRESS_STATUS\");", + "});", + "pm.test(\"params.errmsg should be \\\"Progress status value should be NOT_STARTED(0), STARTED(1), COMPLETED(2).\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Progress status value should be NOT_STARTED(0), STARTED(1), COMPLETED(2).\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "**Accept** relates to content-Type such as **\"MIME\"**, Its used in response body for executing different multi purpose operations.Therefore, its important that the server is correctly set up, so that the MIME types transmitted are recognised and correct to determine what action to do when a resource is fetched." + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "Time Stamp at which **Update a batch** request was sent." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_update_date}}\",\n \"enrollmentEndDate\": \"{{batch_end_date}}\",\n \"status\": 5,\n \"courseId\": \"do_113776650927300608138\",\n \"id\": \"01377666464491929614\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [] + }, + { + "name": "400 - invalid date format", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"DATE_FORMAT_ERRROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"DATE_FORMAT_ERRROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Date format error.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Date format error.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"05/09/2023\",\n \"endDate\": \"{{batch_end_date}}\",\n \"id\": \"01377666260145766417\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [] + }, + { + "name": "400 - invalid enrollmentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"INVALID_PARAMETER_VALUE\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"INVALID_PARAMETER_VALUE\");", + "});", + "pm.test(\"params.errmsg should be \\\"Invalid value join for parameter enrollmentType. Please provide a valid value.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Invalid value join for parameter enrollmentType. Please provide a valid value.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"join\",\n \"startDate\": \"{{batch_start_date}}\",\n \"endDate\": \"{{batch_end_date}}\",\n \"id\":\"01377666260145766417\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [] + }, + { + "name": "400 - invalid endDate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"END_DATE_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"END_DATE_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"End date should be greater than start date.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"End date should be greater than start date.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_start_date}}\",\n \"endDate\": \"2023-04-01\",\n \"id\": \"01377666260145766417\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [] + }, + { + "name": "400 - invalid startDate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode name", + "pm.test(\"Status code name has string \\\"Bad Request\\\"\", () => {", + " pm.expect(pm.response.status).to.have.string(\"Bad Request\");", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify params", + "pm.test(\"params.err should be \\\"INVALID_BATCH_START_DATE_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"INVALID_BATCH_START_DATE_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Please provide valid Start Date.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Please provide valid Start Date.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"do_113776650927300608138\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"2023-01-01\",\n \"endDate\": \"{{batch_end_date}}\",\n \"id\": \"01377666464491929614\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [] + } + ] + } + ] + }, + { + "name": "BatchRead", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum input value", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "Time Stamp at which **Fetch a batch** request was sent." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies the type of device (Mobile)(desktop) used to access Sunbird." + } + ], + "url": "{{host}}/api/course/v1/batch/read/{{batch_id}}" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [] + } + ] + }, + { + "name": "BatchSearch", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum input value", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "Time Stamp at which **Lists the existing batches** request was sent." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies the type of device (Mobile)(desktop) used to access Sunbird." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"filters\": {}\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/list" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "500 - No Filters", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 500\", function () {", + " pm.response.to.have.status(500);", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"SERVER_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"SERVER_ERROR\");", + "});", + "pm.test(\"params.err should be \\\"INTERNAL_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"INTERNAL_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Process failed,please try again later.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Process failed,please try again later.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "Time Stamp at which **Lists the existing batches** request was sent." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies the type of device (Mobile)(desktop) used to access Sunbird." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {}\n}" + }, + "url": "{{host}}/api/course/v1/batch/list" + }, + "response": [] + } + ] + } + ] + }, + { + "name": "BatchCertificate", + "item": [ + { + "name": "BatchCertificateTemplateAdd", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum required fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.add\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "BatchCertificateTemplateAddV1", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:03:57 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29999" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "22" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "181" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "185" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "16" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:03:57:847+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"c65904b2-2474-4fed-a380-6755a99d4cde\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"response\": \"SUCCESS\"\n }\n}" + } + ] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "400 - Missing course id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"id should be api.course.batch.cert.template.add\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.add\");", + "});", + "", + "pm.test(\"ver should be v1\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + "});", + "", + "pm.test(\"params.status should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"{{asset_id}}\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "BatchCertificateTemplateAddV1", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"{{asset_id}}\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 04:50:06 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "333" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29993" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "8" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "12" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "10" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 04:50:06:364+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"d2c803ab-9966-45da-859d-0871b3f961c7\",\n \"err\": \"MANDATORY_PARAMETER_MISSING\",\n \"status\": \"MANDATORY_PARAMETER_MISSING\",\n \"errmsg\": \"Mandatory parameter courseId is missing.\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 -Invalid course id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"err should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.err).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"errmsg should be 'batchId is not linked with courseId'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"batchId is not linked with courseId\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"@#aaa\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "400 -Invalid course id", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"@#aaa\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:23:46 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "288" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29992" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "18" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "26" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "9" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:23:46:171+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"0e9267d5-38dc-4da0-ae3f-2e48390bb1dd\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"batchId is not linked with courseId\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Missing asset id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"id should be api.course.batch.cert.template.add\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.add\");", + "});", + "", + "pm.test(\"ver should be v1\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + "});", + "", + "pm.test(\"params.status should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "400 - Missing asset id", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 04:54:56 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "335" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29990" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "6" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "11" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "13" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 04:54:56:569+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"ee76fcde-9384-4592-af5b-7f876b5a15db\",\n \"err\": \"MANDATORY_PARAMETER_MISSING\",\n \"status\": \"MANDATORY_PARAMETER_MISSING\",\n \"errmsg\": \"Mandatory parameter identifier is missing.\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Invalid asset id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"err should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.err).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_Aaaa\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "400 - Invalid asset id", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_Aaaa\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:25:38 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "291" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29991" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "122" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "126" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "8" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:25:38:784+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"a2234845-0bb3-448d-a1dc-22310d0f0625\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"Given cert template not found: do_Aaaa\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Missing batch id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"id should be api.course.batch.cert.template.add\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.add\");", + "});", + "", + "pm.test(\"ver should be v1\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + "});", + "", + "pm.test(\"params.status should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "400 - Missing batch id", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"template\": {\n \"identifier\": \"{{asset_id}}\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 04:53:22 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "332" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29991" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "6" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "10" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "12" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 04:53:22:779+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"e099eb0d-fc6d-41ac-b8ed-9f3104e17280\",\n \"err\": \"MANDATORY_PARAMETER_MISSING\",\n \"status\": \"MANDATORY_PARAMETER_MISSING\",\n \"errmsg\": \"Mandatory parameter batchId is missing.\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Invalid batch id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"err should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.err).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"errmsg should be 'No such batchId exists'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"No such batchId exists\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"1234@#4\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "400 - Invalid batch id", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"1234@#4\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:28:13 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "275" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29989" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "10" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "14" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "13" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:28:13:324+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"b9e5e661-f158-4e68-97a6-641c172e4a47\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"No such batchId exists\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Missing Issuer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "", + "// Validation", + "pm.test(\"id should be api.course.batch.cert.template.add\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.add\");", + "});", + "", + "pm.test(\"ver should be v1\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + "});", + "", + "pm.test(\"params.status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ]\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "400 - Missing Issuer", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ]\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:05:48 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "332" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29996" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "34" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "38" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "10" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:05:48:478+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"0f799981-8c4c-4a0a-b057-caba4bc14125\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"Issuer or signatoryList is empty. Invalid template Id: do_113788048780771328112\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Missing signatoryList", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "", + "// Validation", + "pm.test(\"id should be api.course.batch.cert.template.add\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.add\");", + "});", + "", + "pm.test(\"ver should be v1\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + "});", + "", + "pm.test(\"params.status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "400 - Missing signatoryList", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:01:43 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "332" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29998" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "45" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "49" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "10" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:01:43:968+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"9c213f1d-26e5-468e-858e-01eefcee7613\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"Issuer or signatoryList is empty. Invalid template Id: do_113788048780771328112\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Missing Criteria", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "", + "// Validation", + "pm.test(\"id should be api.course.batch.cert.template.add\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.add\");", + "});", + "", + "pm.test(\"ver should be v1\", function () {", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + "});", + "", + "pm.test(\"params.status should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "400 - Missing criteria", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 04:59:58 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "333" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29983" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "16" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "20" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "8" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 04:59:58:690+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"e944068c-b6e7-440e-a309-a15c3809093b\",\n \"err\": \"MANDATORY_PARAMETER_MISSING\",\n \"status\": \"MANDATORY_PARAMETER_MISSING\",\n \"errmsg\": \"Mandatory parameter criteria is missing.\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + } + ] + } + ] + }, + { + "name": "BatchCertificateIssue", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum required input", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.issue\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "response": [ + { + "name": "BatchCertificateIssueV1", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:05:45 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29998" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "225" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "12" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "14" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "1" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.issue\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:05:45:247+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"3b0520de-14ca-4c27-9d51-26e469c9ef00\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"result\": {\n \"batchId\": \"0138758519984209923\",\n \"courseId\": \"do_113776650927300608138\",\n \"collectionId\": \"do_113776650927300608138\",\n \"status\": \"Certificates issue action for Course Batch Id 0138758519984209923 submitted Successfully!\"\n }\n }\n}" + } + ] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "400 - Missing courseId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"err should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.err).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"status should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"errmsg should be 'Mandatory parameter courseId/collectionId is missing.'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter courseId/collectionId is missing.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batchId\": \"{{batch_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "response": [ + { + "name": "400 - Missing courseId", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batchId\": \"{{batch_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:34:20 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "339" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29998" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "5" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "7" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "9" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.issue\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:34:20:507+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"c6cf3e16-fa4e-42c3-b378-fc7475c27fde\",\n \"err\": \"MANDATORY_PARAMETER_MISSING\",\n \"status\": \"MANDATORY_PARAMETER_MISSING\",\n \"errmsg\": \"Mandatory parameter courseId/collectionId is missing.\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Missing batchId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "pm.test(\"Test data type of the response and keys\", () => {", + " pm.expect(jsonResponse).to.be.an(\"object\").that.has.all.keys(", + " 'id', 'ver', 'ts', 'params', 'responseCode', 'result'", + " );", + "", + " pm.expect(jsonResponse.id).to.be.a(\"string\");", + " pm.expect(jsonResponse.ver).to.be.a(\"string\");", + " pm.expect(jsonResponse.ts).to.be.a(\"string\");", + " pm.expect(jsonResponse.responseCode).to.be.a(\"string\");", + "", + " pm.expect(jsonResponse.params).to.be.an(\"object\").that.has.all.keys(", + " 'resmsgid', 'msgid', 'err', 'status', 'errmsg'", + " );", + "", + " pm.expect(jsonResponse.params.resmsgid).to.be.null;", + " pm.expect(jsonResponse.params.msgid).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.err).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.status).to.be.a(\"string\");", + " pm.expect(jsonResponse.params.errmsg).to.be.a(\"string\");", + "", + " pm.expect(jsonResponse.result).to.be.an(\"object\");", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"err should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.err).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"status should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"errmsg should be 'Mandatory parameter batchId is missing.'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter batchId is missing.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "response": [ + { + "name": "400 - missing batchId", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:37:06 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "325" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29996" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "8" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "16" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "62" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.issue\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:37:06:782+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"21a9de3c-386c-471b-b339-5a7c367a0320\",\n \"err\": \"MANDATORY_PARAMETER_MISSING\",\n \"status\": \"MANDATORY_PARAMETER_MISSING\",\n \"errmsg\": \"Mandatory parameter batchId is missing.\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Invalid course id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"errmsg should be 'batchId is not linked with courseId'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"batchId is not linked with courseId\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"aaaa\",\n \"batchId\": \"{{batch_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "response": [ + { + "name": "400 - Invalid course id", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"aaaa\",\n \"batchId\": \"{{batch_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:41:49 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "281" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29992" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "9" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "13" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "30" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.issue\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:41:49:689+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"8588f5e9-befb-438e-930c-0d4d8ee81af2\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"batchId is not linked with courseId\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Invalid batch id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"errmsg should be 'No such batchId exists'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"No such batchId exists\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"aaa@123\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "response": [ + { + "name": "400 - Invalid batchId", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"aaa@123\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:43:27 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "268" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29990" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "11" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "14" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "9" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.issue\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:43:27:896+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"d16956b9-5e0d-480d-a895-d8a8cb770ca8\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"No such batchId exists\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + } + ] + } + ] + }, + { + "name": "BatchCertificateTemplateRemove", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum required fields", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.remove\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + " pm.expect(jsonResponse.result.response).to.eql(\"SUCCESS\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "response": [ + { + "name": "BatchCertificateTemplateRemoveV1", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:05:06 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29997" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "22" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "59" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "63" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "15" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.remove\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:05:06:969+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"9c73b81e-d9c2-445e-bbad-846941c94de3\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"response\": \"SUCCESS\"\n }\n}" + } + ] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "400 - Missing courseId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"errmsg should be 'No such batchId exists'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"No such batchId exists\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "response": [ + { + "name": "400 - Missing courseId", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:46:26 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "336" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29997" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "7" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "10" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "10" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.remove\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:46:26:287+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"4dad4911-1eaa-414e-952c-4cf243935ec0\",\n \"err\": \"MANDATORY_PARAMETER_MISSING\",\n \"status\": \"MANDATORY_PARAMETER_MISSING\",\n \"errmsg\": \"Mandatory parameter courseId is missing.\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Missing batchId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"status should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"errmsg should be 'Mandatory parameter batchId is missing.'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter batchId is missing.\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "response": [ + { + "name": "400 - Missing batchId", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:47:58 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "335" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29995" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "5" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "12" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "71" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.remove\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:47:58:888+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"0c98d5c3-a0ff-4dbe-a473-d3a0bfd9ddd8\",\n \"err\": \"MANDATORY_PARAMETER_MISSING\",\n \"status\": \"MANDATORY_PARAMETER_MISSING\",\n \"errmsg\": \"Mandatory parameter batchId is missing.\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Missing templateId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"status should be MANDATORY_PARAMETER_MISSING\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"MANDATORY_PARAMETER_MISSING\");", + "});", + "", + "pm.test(\"errmsg should be 'Mandatory parameter identifier is missing.'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Mandatory parameter identifier is missing.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {}\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "response": [ + { + "name": "400 - Missing templateId", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {}\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:49:22 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "338" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29993" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "7" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "10" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "9" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.remove\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:49:22:066+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"e81fe9cf-75b5-4fe7-8327-f04e28e7f72d\",\n \"err\": \"MANDATORY_PARAMETER_MISSING\",\n \"status\": \"MANDATORY_PARAMETER_MISSING\",\n \"errmsg\": \"Mandatory parameter identifier is missing.\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Invalid course id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"errmsg should be 'batchId is not linked with courseId'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"batchId is not linked with courseId\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"AAAA\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "response": [ + { + "name": "400 - Invalid course id", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"AAAA\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:53:57 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "291" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29991" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "13" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "16" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "13" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.remove\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:53:57:423+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"806eed1f-ebbc-486f-b054-331b0bf12886\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"batchId is not linked with courseId\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Invalid batchId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});", + "", + "pm.test(\"errmsg should be 'No such batchId exists'\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"No such batchId exists\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"12@#111\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "response": [ + { + "name": "400 - Invalid batchId", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"12@#111\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:55:05 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "278" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29990" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "9" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "12" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "58" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.remove\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:55:05:851+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"10864fcc-14ba-4fff-b55e-dc321559235f\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"No such batchId exists\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + }, + { + "name": "400 - Invalid templateId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"responseCode should be CLIENT_ERROR\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "pm.test(\"status should be SERVER_ERROR\", function () {", + " pm.expect(jsonResponse.params.status).to.eql(\"SERVER_ERROR\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"aaaa@#$\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "response": [ + { + "name": "400 - Invalid templateId", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"aaaa@#$\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Tue, 12 Sep 2023 05:56:47 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "294" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29989" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "73" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "77" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "10" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.remove\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-12 05:56:47:893+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"03ee11aa-dc4a-48f2-9466-caccaa35f5b2\",\n \"err\": null,\n \"status\": \"SERVER_ERROR\",\n \"errmsg\": \"Given cert template not found: aaaa@#$\"\n },\n \"responseCode\": \"CLIENT_ERROR\",\n \"result\": {}\n}" + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "BatchList", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum input value", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"filters\": {}\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/list" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "500 - No Filters", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 500\", function () {", + " pm.response.to.have.status(500);", + "});", + "", + "// Validation", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"SERVER_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.responseCode).to.eql(\"SERVER_ERROR\");", + "});", + "pm.test(\"params.err should be \\\"INTERNAL_ERROR\\\"\", () => {", + " pm.expect(jsonResponse.params.err).to.eql(\"INTERNAL_ERROR\");", + "});", + "pm.test(\"params.errmsg should be \\\"Process failed,please try again later.\\\"\", () => {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Process failed,please try again later.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {}\n}" + }, + "url": "{{host}}/api/course/v1/batch/list" + }, + "response": [] + } + ] + } + ] + } + ] + }, + { + "name": "CourseEnroll", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "CourseEnrollV1", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/v1/enroll" + }, + "response": [] + }, + { + "name": "CourseUnEnrollV1", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/v1/unenroll" + }, + "response": [] + }, + { + "name": "CourseEnrollListV1", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + } + ], + "url": "{{host}}/api/course/v1/user/enrollment/list/{{user_id}}" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "CourseEnrollV1", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/v1/enroll" + }, + "response": [] + }, + { + "name": "CourseUnEnrollV1", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/v1/unenroll" + }, + "response": [] + }, + { + "name": "CourseEnrollListV1", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + } + ], + "url": "{{host}}/api/course/v1/user/enrollment/list/{{user_id}}" + }, + "response": [] + } + ] + } + ] + }, + { + "name": "ContentAPIs", + "item": [ + { + "name": "ContentRead", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum input value", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"filters\": {}\n }\n}" + }, + "url": "{{host}}/api/content/v1/search" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "400 - Missing filters", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is CLIENT_ERROR (400)\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify err", + "pm.test(\"err should be \\\"ERR_CONTENT_SEARCH_FIELDS_MISSING\\\"\", function () {", + " pm.expect(jsonResponse.params.err).to.eql(\"ERR_CONTENT_SEARCH_FIELDS_MISSING\");", + "});", + "", + "// Verify errmsg", + "pm.test(\"errmsg should be \\\"Required fields for search content are missing\\\"\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"Required fields for search content are missing\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {}\n}" + }, + "url": "{{host}}/api/content/v1/search" + }, + "response": [] + } + ] + } + ] + }, + { + "name": "ContentStateRead", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "ContentStateReadV1", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"userId\": \"{{user_id}}\",\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/v1/content/state/read" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [] + } + ] + }, + { + "name": "ContentStateUpdate", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "ContentStateUpdateV1", + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"userId\": \"{{user_id}}\",\n \"contents\": [\n {\n \"contentId\": \"{{content_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"status\": 2,\n \"courseId\": \"{{course_id}}\",\n \"lastAccessTime\": \"2020-11-23 12:58:35:179+0000\"\n }\n ]\n }\n}" + }, + "url": "{{host}}/api/course/v1/content/state/update" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [] + } + ] + } + ] + }, + { + "name": "AggregateAPIs", + "item": [ + { + "name": "Positive", + "item": [ + { + "name": "200 - Minimum input value", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"groupId\": \"{{group_id}}\",\n \"activityId\": \"{{activity_id}}\",\n \"activityType\": \"Course\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/data/v1/group/activity/agg" + }, + "response": [] + } + ] + }, + { + "name": "Negative", + "item": [ + { + "name": "400 - Missing activity id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is CLIENT_ERROR (400)\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify err", + "pm.test(\"err should be \\\"ACTIVITY_ID_MISSING\\\"\", function () {", + " pm.expect(jsonResponse.params.err).to.eql(\"ACTIVITY_ID_MISSING\");", + "});", + "", + "// Verify errmsg", + "pm.test(\"errmsg should be \\\"ActivityId is mandatory.\\\"\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"ActivityId is mandatory.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"groupId\": \"{{group_id}}\",\n \"activityType\": \"Course\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/data/v1/group/activity/agg" + }, + "response": [] + }, + { + "name": "400 - Missing group id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is CLIENT_ERROR (400)\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify err", + "pm.test(\"err should be \\\"GROUP_ID_MISSING\\\"\", function () {", + " pm.expect(jsonResponse.params.err).to.eql(\"GROUP_ID_MISSING\");", + "});", + "", + "// Verify errmsg", + "pm.test(\"errmsg should be \\\"GroupId is mandatory.\\\"\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"GroupId is mandatory.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"activityId\": \"do_113776660278427648168\",\n \"activityType\": \"Course\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/data/v1/group/activity/agg" + }, + "response": [] + }, + { + "name": "400 - Missing activity type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is CLIENT_ERROR (400)\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "// Verify responseCode", + "pm.test(\"responseCode should be \\\"CLIENT_ERROR\\\"\", function () {", + " pm.expect(jsonResponse.responseCode).to.eql(\"CLIENT_ERROR\");", + "});", + "", + "// Verify err", + "pm.test(\"err should be \\\"ACTIVITY_TYPE_MISSING\\\"\", function () {", + " pm.expect(jsonResponse.params.err).to.eql(\"ACTIVITY_TYPE_MISSING\");", + "});", + "", + "// Verify errmsg", + "pm.test(\"errmsg should be \\\"ActivityType is mandatory.\\\"\", function () {", + " pm.expect(jsonResponse.params.errmsg).to.eql(\"ActivityType is mandatory.\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"groupId\": \"{{group_id}}\",\n \"activityId\": \"do_113776660278427648168\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/data/v1/group/activity/agg" + }, + "response": [] + } + ] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + " function generateRandomBatchName() {", + " const adjectives = ['Advanced', 'Beginner', 'Intermediate', 'Expert', 'Pro', 'Novice', 'Skilled', 'Enthusiastic'];", + " const subjects = ['Math', 'Science', 'History', 'Literature', 'Programming', 'Languages', 'Art', 'Music'];", + " const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];", + " const randomSubject = subjects[Math.floor(Math.random() * subjects.length)];", + " const randomNumber = Math.floor(Math.random() * 1000);", + " ", + " return `${randomAdjective} ${randomSubject} Batch ${randomNumber}`;", + "}", + "", + "function generateRandomDescription() {", + " const phrases = [", + " 'Join this batch to enhance your knowledge and skills.',", + " 'In this batch, we explore various topics and concepts.',", + " 'Looking for an engaging learning experience? Join this batch now!',", + " 'We focus on interactive learning and collaborative discussions.',", + " 'This batch is open to learners of all levels.'", + " ];", + " ", + " const randomPhrase = phrases[Math.floor(Math.random() * phrases.length)];", + " return randomPhrase;", + "}", + "", + "const batchName = generateRandomBatchName();", + "const batchDescription = generateRandomDescription();", + "// Calculate the start date (current date - 5 days)", + "const currentDate = new Date();", + "const startDate = new Date(currentDate);", + "startDate.setDate(currentDate.getDate());", + "", + "// Calculate the end date (end of 3 months from current date)", + "const endDate = new Date(currentDate);", + "endDate.setMonth(currentDate.getMonth() + 3, 0); // Set to the last day of the third month", + "", + "// Format dates as strings (YYYY-MM-DD)", + "const formattedStartDate = startDate.toISOString().split('T')[0];", + "const formattedEndDate = endDate.toISOString().split('T')[0];", + "", + "// Get the current date", + "const currentUpdateDate = new Date();", + "", + "// Add 5 days to the current date", + "const updateDate = new Date(currentUpdateDate);", + "updateDate.setDate(currentUpdateDate.getDate() + 5);", + "", + "// Format the update date as a string (YYYY-MM-DD)", + "const formattedUpdateDate = updateDate.toISOString().split('T')[0];", + "", + "// Set the environment variable", + "pm.environment.set('batch_update_date', formattedUpdateDate);", + "", + "", + "// Set the environment variables", + "pm.environment.set('batch_start_date', formattedStartDate);", + "pm.environment.set('batch_end_date', formattedEndDate);", + "", + "", + "pm.environment.set('batch_name', batchName);", + "pm.environment.set('batch_description', batchDescription);", + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] +} \ No newline at end of file diff --git a/api-tests/Collection/Lms_APIs.postman_collection.json b/api-tests/Collection/Lms_APIs.postman_collection.json new file mode 100644 index 000000000..b43993966 --- /dev/null +++ b/api-tests/Collection/Lms_APIs.postman_collection.json @@ -0,0 +1,2211 @@ +{ + "info": { + "_postman_id": "62875837-0ef2-4b6e-b6c2-9e5f3cc6ded4", + "name": "Lms_APIs", + "description": "The LMS APIs is a collection of API's for creation and management of batches,enrollment to the courses,content state related APIs,Aggregation Apis", + "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json", + "_exporter_id": "4875988", + "_collection_link": "https://dark-star-147860.postman.co/workspace/LernBBAPIs~32e17cc4-6806-407e-b8ef-485ad4d0b712/collection/4875988-62875837-0ef2-4b6e-b6c2-9e5f3cc6ded4?action=share&source=collection_link&creator=4875988" + }, + "item": [ + { + "name": "HealthCheck", + "item": [ + { + "name": "HealthCheck", + "request": { + "method": "GET", + "header": [], + "url": "{{host}}/health" + }, + "response": [] + } + ] + }, + { + "name": "AuthToken", + "item": [ + { + "name": "UserToken", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let jsonResponse = pm.response.json();", + "", + "// Set global variable", + "// pm.variables.set('refresh_token', jsonResponse.refresh_token);", + "// pm.globals.set(\"refresh_token\", jsonResponse.result.identifier);", + "pm.collectionVariables.set(\"refresh_token\", jsonResponse.refresh_token);", + "// pm.collectionVariables.set(\"variable_key\", \"variable_value\");", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + }, + { + "key": "Cookie", + "value": "connect.sid=s%3Ad3chYLP8OfuB2bWgfEFohiWpDxM7GFol.gOPmzH3d2nP9enZ5qSHlVx1e%2BozTleCjXtfz7LUycCk" + } + ], + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "client_id", + "value": "{{auth_client_id}}", + "type": "text" + }, + { + "key": "client_secret", + "value": "{{auth_client_secret}}", + "type": "text" + }, + { + "key": "grant_type", + "value": "password", + "type": "text" + }, + { + "key": "username", + "value": "{{username}}", + "type": "text" + }, + { + "key": "password", + "value": "{{password}}", + "type": "text" + } + ] + }, + "url": "{{host}}/auth/realms/sunbird/protocol/openid-connect/token" + }, + "response": [] + }, + { + "name": "RefreshToken", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Extract the locationId from the response and set it to the environment variable", + "pm.test(\"Set access_token in environment variable\", function () {", + " const responseJson = pm.response.json();", + " pm.environment.set(\"keycloak_access_token\", responseJson.result.access_token);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "{{kong_api_key}}" + }, + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + }, + { + "key": "Cookie", + "value": "connect.sid=s%3Ad3chYLP8OfuB2bWgfEFohiWpDxM7GFol.gOPmzH3d2nP9enZ5qSHlVx1e%2BozTleCjXtfz7LUycCk" + } + ], + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "refresh_token", + "value": "{{refresh_token}}", + "type": "text" + } + ] + }, + "url": "{{host}}/auth/v1/refresh/token" + }, + "response": [] + } + ] + }, + { + "name": "BatchAPIs", + "item": [ + { + "name": "BatchCreation", + "item": [ + { + "name": "CreateBatchV1", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "// Extract the batchId from the response and set it to the environment variable", + "pm.test(\"Set batchId in environment variable\", function () {", + " const responseJson = pm.response.json();", + " console.log( responseJson.result.batchId)", + " pm.environment.set(\"batch_id\", responseJson.result.batchId);", + "});", + "", + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.create\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "", + " // You can add more specific validations here if needed", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_start_date}}\",\n \"endDate\": \"{{batch_end_date}}\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/create" + }, + "response": [ + { + "name": "CreateBatchV1", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"name\": \"{{batch_name}}\",\n \"description\": \"{{batch_description}}\",\n \"enrollmentType\": \"open\",\n \"startDate\": \"{{batch_start_date}}\",\n \"endDate\": \"{{batch_end_date}}\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/create" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:21:33 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29998" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "54" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "55" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "58" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "58" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.create\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:21:33:761+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"ebf734ee-880e-4345-adf2-5752e1717b02\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"response\": \"SUCCESS\",\n \"batchId\": \"0138786333558784001\"\n }\n}" + } + ] + } + ] + }, + { + "name": "BatchUpdation", + "item": [ + { + "name": "UpdateBatchV1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.update\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "", + " // You can add more specific validations here if needed", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "**Accept** relates to content-Type such as **\"MIME\"**, Its used in response body for executing different multi purpose operations.Therefore, its important that the server is correctly set up, so that the MIME types transmitted are recognised and correct to determine what action to do when a resource is fetched." + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "Time Stamp at which **Update a batch** request was sent." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"enrollmentType\": \"open\",\n \"startDate\": \"2023-09-08\",\n \"enrollmentEndDate\": \"{{batch_end_date}}\",\n \"status\": 1,\n \"courseId\": \"{{course_id}}\",\n \"id\": \"{{batch_id}}\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "response": [ + { + "name": "UpdateBatchV1", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "**Accept** relates to content-Type such as **\"MIME\"**, Its used in response body for executing different multi purpose operations.Therefore, its important that the server is correctly set up, so that the MIME types transmitted are recognised and correct to determine what action to do when a resource is fetched." + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "Time Stamp at which **Update a batch** request was sent." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"enrollmentType\": \"open\",\n \"startDate\": \"2023-09-08\",\n \"enrollmentEndDate\": \"{{batch_end_date}}\",\n \"status\": 1,\n \"courseId\": \"{{course_id}}\",\n \"id\": \"{{batch_id}}\"\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/update" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:23:03 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Content-Length", + "value": "229" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29997" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "2" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "46" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "49" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "10" + }, + { + "key": "Via", + "value": "kong/0.14.1" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.update\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:23:03:404+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"a31a7bbe-c99c-43aa-bc22-3b656c2b6fa2\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {}\n}" + } + ] + } + ] + }, + { + "name": "BatchRead", + "item": [ + { + "name": "ReadBatchV1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.read\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "", + " // You can add more specific validations here if needed", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "Time Stamp at which **Fetch a batch** request was sent." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies the type of device (Mobile)(desktop) used to access Sunbird." + } + ], + "url": "{{host}}/api/course/v1/batch/read/{{batch_id}}" + }, + "response": [ + { + "name": "ReadBatchV1", + "originalRequest": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "Time Stamp at which **Fetch a batch** request was sent." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies the type of device (Mobile)(desktop) used to access Sunbird." + } + ], + "url": "{{host}}/api/course/v1/batch/read/{{batch_id}}" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:24:16 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29999" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "622" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "6" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "9" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "37" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "X-Proxy-Cache", + "value": "HIT" + }, + { + "key": "X-Proxy-Cache-Date", + "value": "Fri, 08 Sep 2023 10:23:25 GMT" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.read\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:23:25:035+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"c11e68d3-c681-4eb9-b7e3-d051ac9b949c\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"response\": {\n \"identifier\": \"0138786333558784001\",\n \"createdFor\": [],\n \"certTemplates\": {},\n \"endDate\": \"2023-11-30\",\n \"description\": \"Join this batch to enhance your knowledge and skills.\",\n \"updatedDate\": \"2023-09-08 15:53:03:367+0530\",\n \"batchId\": \"0138786333558784001\",\n \"cert_templates\": {},\n \"createdDate\": \"2023-09-08 15:51:33:731+0530\",\n \"createdBy\": \"155ce3c5-713e-4749-bc1c-95d09c640914\",\n \"mentors\": [],\n \"name\": \"Skilled Programming Batch 768\",\n \"id\": \"0138786333558784001\",\n \"enrollmentType\": \"open\",\n \"courseId\": \"do_113776650927300608138\",\n \"enrollmentEndDate\": \"2023-11-30\",\n \"collectionId\": \"do_113776650927300608138\",\n \"startDate\": \"2023-09-08\",\n \"status\": 1\n }\n }\n}" + } + ] + } + ] + }, + { + "name": "BatchSearch", + "item": [ + { + "name": "SearchBatchV1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.search\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "", + " // You can add more specific validations here if needed", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "Time Stamp at which **Lists the existing batches** request was sent." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies the type of device (Mobile)(desktop) used to access Sunbird." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"filters\": {\n \"courseId\": \"{{course_id}}\"\n },\n \"limit\": 2\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/list" + }, + "response": [ + { + "name": "SearchBatchV1", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text", + "description": "The Content Type entity is the media type of the resource.Possible media types can be:- \n\n - Application/json\n\n - Multipart/form-data\n\n - Application/x-www-form-urlencoded" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text", + "description": "Time Stamp at which **Lists the existing batches** request was sent." + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text", + "description": "This Id Uniquely identifies a request if the same API is executed multiple times." + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text", + "description": "This Id Uniquely identifies the type of device (Mobile)(desktop) used to access Sunbird." + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"filters\": {\n \"courseId\": \"{{course_id}}\"\n },\n \"limit\": 2\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/list" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:25:15 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29998" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "1128" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "11" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "13" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "11" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.search\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:25:15:235+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"deaed9d6-6c5e-4b80-83cd-c06e9105aead\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"response\": {\n \"count\": 6,\n \"content\": [\n {\n \"identifier\": \"01377666464491929614\",\n \"createdFor\": [\n \"0137541424673095687\"\n ],\n \"endDate\": null,\n \"description\": \"\",\n \"updatedDate\": null,\n \"batchId\": \"01377666464491929614\",\n \"cert_templates\": null,\n \"createdDate\": \"2023-04-17 14:10:56:631+0530\",\n \"createdBy\": \"155ce3c5-713e-4749-bc1c-95d09c640914\",\n \"mentors\": [\n \"6a7bfa76-4b58-4f79-bd26-b9c671211fbd\"\n ],\n \"name\": \"First batch - DO NOT MODIFY\",\n \"id\": \"01377666464491929614\",\n \"enrollmentType\": \"open\",\n \"courseId\": \"do_113776650927300608138\",\n \"enrollmentEndDate\": null,\n \"collectionId\": \"do_113776650927300608138\",\n \"startDate\": \"2023-04-17\",\n \"status\": 1\n },\n {\n \"identifier\": \"0138756792993136641\",\n \"endDate\": \"2023-11-30\",\n \"description\": \"We focus on interactive learning and collaborative discussions.\",\n \"updatedDate\": null,\n \"batchId\": \"0138756792993136641\",\n \"cert_templates\": null,\n \"createdDate\": \"2023-09-04 11:51:23:367+0530\",\n \"createdBy\": \"155ce3c5-713e-4749-bc1c-95d09c640914\",\n \"name\": \"Pro Languages Batch 437\",\n \"id\": \"0138756792993136641\",\n \"enrollmentType\": \"open\",\n \"courseId\": \"do_113776650927300608138\",\n \"enrollmentEndDate\": null,\n \"collectionId\": \"do_113776650927300608138\",\n \"startDate\": \"2023-09-04\",\n \"status\": 1\n }\n ]\n }\n }\n}" + } + ] + } + ] + }, + { + "name": "BatchList", + "item": [ + { + "name": "ListBatchV1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.search\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "", + " // Additional validation can be added if needed", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"filters\": {\n \"batchId\": [\n \"{{batch-id}}\"\n ]\n },\n \"fields\": [\n \"name\",\n \"batchId\",\n \"startDate\",\n \"endDate\"\n ],\n \"limit\": 133\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/list" + }, + "response": [ + { + "name": "ListBatchV1", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"filters\": {\n \"batchId\": [\n \"{{batch-id}}\"\n ]\n },\n \"fields\": [\n \"name\",\n \"batchId\",\n \"startDate\",\n \"endDate\"\n ],\n \"limit\": 133\n }\n}" + }, + "url": "{{host}}/api/course/v1/batch/list" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 11:45:32 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29999" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "37" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "10" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "13" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "61" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.search\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 11:45:32:359+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"895b2f39-a79d-4efd-bd9b-7448203da307\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"response\": {\n \"count\": 0,\n \"content\": []\n }\n }\n}" + } + ] + } + ] + }, + { + "name": "BatchCertificate", + "item": [ + { + "name": "BatchCertificateTemplateAddV1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.add\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "response": [ + { + "name": "BatchCertificateTemplateAddV1", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\",\n \"criteria\": {\n \"enrollment\": {\n \"status\": \"2\"\n }\n },\n \"signatoryList\": [\n {\n \"name\": \"string\",\n \"id\": \"string\",\n \"designation\": \"CEO\",\n \"image\": \"string\"\n }\n ],\n \"issuer\": {\n \"name\": \"string\",\n \"url\": \"string\",\n \"publicKey\": [\n 7,\n 8\n ]\n }\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/add" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:03:57 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29999" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "22" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "181" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "185" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "16" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.add\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:03:57:847+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"c65904b2-2474-4fed-a380-6755a99d4cde\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"response\": \"SUCCESS\"\n }\n}" + } + ] + }, + { + "name": "BatchCertificateTemplateRemoveV1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.template.remove\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + " pm.expect(jsonResponse.result.response).to.eql(\"SUCCESS\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "response": [ + { + "name": "BatchCertificateTemplateRemoveV1", + "originalRequest": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"batch\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"template\": {\n \"identifier\": \"do_113788048780771328112\"\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/batch/cert/v1/template/remove" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:05:06 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29997" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "22" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "59" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "63" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "15" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.template.remove\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:05:06:969+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"9c73b81e-d9c2-445e-bbad-846941c94de3\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"response\": \"SUCCESS\"\n }\n}" + } + ] + }, + { + "name": "BatchCertificateIssueV1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');", + "});", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.course.batch.cert.issue\");", + " pm.expect(jsonResponse.ver).to.eql(\"v1\");", + " pm.expect(jsonResponse.params.status).to.eql(\"success\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "response": [ + { + "name": "BatchCertificateIssueV1", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "X-authenticated-user-token", + "value": "{{keycloak_access_token}}" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"userIds\": [\n \"{{user_id}}\"\n ]\n }\n}" + }, + "url": "{{host}}/api/course/batch/cert/v1/issue" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:05:45 GMT" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29998" + }, + { + "key": "referrer-policy", + "value": "origin-when-cross-origin, strict-origin-when-cross-origin" + }, + { + "key": "x-frame-options", + "value": "DENY" + }, + { + "key": "x-xss-protection", + "value": "1; mode=block" + }, + { + "key": "x-response-length", + "value": "225" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "x-permitted-cross-domain-policies", + "value": "master-only" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "12" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "14" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "1" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.course.batch.cert.issue\",\n \"ver\": \"v1\",\n \"ts\": \"2023-09-08 10:05:45:247+0000\",\n \"params\": {\n \"resmsgid\": null,\n \"msgid\": \"3b0520de-14ca-4c27-9d51-26e469c9ef00\",\n \"err\": null,\n \"status\": \"success\",\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"result\": {\n \"batchId\": \"0138758519984209923\",\n \"courseId\": \"do_113776650927300608138\",\n \"collectionId\": \"do_113776650927300608138\",\n \"status\": \"Certificates issue action for Course Batch Id 0138758519984209923 submitted Successfully!\"\n }\n }\n}" + } + ] + } + ] + } + ] + }, + { + "name": "CourseEnroll", + "item": [ + { + "name": "CourseEnrollV1", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/v1/enroll" + }, + "response": [] + }, + { + "name": "CourseUnEnrollV1", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/v1/unenroll" + }, + "response": [] + }, + { + "name": "CourseEnrollListV1", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + } + ], + "url": "{{host}}/api/course/v1/user/enrollment/list/{{user_id}}" + }, + "response": [] + } + ] + }, + { + "name": "ContentAPIs", + "item": [ + { + "name": "ContentSearchV1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "// Parse the response JSON body", + "let jsonResponse = pm.response.json();", + "", + "// Verification", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Content-Type header is present\", () => {", + " pm.response.to.have.header(\"Content-Type\");", + "});", + "", + "pm.test(\"Content-Type header is application/json\", () => {", + " pm.expect(pm.response.headers.get('Content-Type')).to.include('application/json');", + "});", + "", + "// Validation", + "pm.test(\"Validate specific field values\", function () {", + " pm.expect(jsonResponse.id).to.eql(\"api.content.search\");", + " pm.expect(jsonResponse.ver).to.eql(\"1.0\");", + " pm.expect(jsonResponse.responseCode).to.eql(\"OK\");", + "", + " // Additional validation can be added if needed", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"query\": \"{{course_id}}\",\n \"filters\": {\n \"primaryCategory\": \"Course\"\n },\n \"fields\": [\n \"name\",\n \"status\",\n \"createdBy\",\n \"creator\"\n ]\n }\n}" + }, + "url": "{{host}}/api/content/v1/search" + }, + "response": [ + { + "name": "ContentSearchV1", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"query\": \"{{course_id}}\",\n \"filters\": {\n \"primaryCategory\": \"Course\"\n },\n \"fields\": [\n \"name\",\n \"status\",\n \"createdBy\",\n \"creator\"\n ]\n }\n}" + }, + "url": "{{host}}/api/content/v1/search" + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Date", + "value": "Fri, 08 Sep 2023 10:31:46 GMT" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Vary", + "value": "Accept-Encoding" + }, + { + "key": "X-RateLimit-Limit-hour", + "value": "30000" + }, + { + "key": "X-RateLimit-Remaining-hour", + "value": "29997" + }, + { + "key": "x-powered-by", + "value": "Express" + }, + { + "key": "vary", + "value": "X-HTTP-Method-Override" + }, + { + "key": "access-control-allow-origin", + "value": "*" + }, + { + "key": "access-control-allow-methods", + "value": "GET,PUT,POST,PATCH,DELETE,OPTIONS" + }, + { + "key": "access-control-allow-headers", + "value": "Content-Type, Authorization,cid, user-id, x-auth, Cache-Control, X-Requested-With, *" + }, + { + "key": "etag", + "value": "W/\"1d0-gmfDS2YIsbvP2jER1frPDEeKlxI\"" + }, + { + "key": "x-envoy-upstream-service-time", + "value": "28" + }, + { + "key": "X-Kong-Upstream-Latency", + "value": "31" + }, + { + "key": "X-Kong-Proxy-Latency", + "value": "11" + }, + { + "key": "Via", + "value": "kong/0.14.1" + }, + { + "key": "X-Proxy-Cache", + "value": "HIT" + }, + { + "key": "X-Proxy-Cache-Date", + "value": "Fri, 08 Sep 2023 10:31:24 GMT" + }, + { + "key": "Content-Encoding", + "value": "gzip" + } + ], + "cookie": [], + "body": "{\n \"id\": \"api.content.search\",\n \"ver\": \"1.0\",\n \"ts\": \"2023-09-08T10:31:24.172Z\",\n \"params\": {\n \"resmsgid\": \"dc0524c0-4e32-11ee-826b-63a1868fac2e\",\n \"msgid\": \"dc010610-4e32-11ee-b07c-cfa90feefa97\",\n \"status\": \"successful\",\n \"err\": null,\n \"errmsg\": null\n },\n \"responseCode\": \"OK\",\n \"result\": {\n \"count\": 1,\n \"content\": [\n {\n \"identifier\": \"do_113776650927300608138\",\n \"creator\": \"contentCreator Creator\",\n \"createdBy\": \"155ce3c5-713e-4749-bc1c-95d09c640914\",\n \"name\": \"Course 2\",\n \"objectType\": \"Content\",\n \"status\": \"Live\"\n }\n ]\n }\n}" + } + ] + }, + { + "name": "ContentStateReadV1", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"userId\": \"{{user_id}}\",\n \"courseId\": \"{{course_id}}\",\n \"batchId\": \"{{batch_id}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/course/v1/content/state/read" + }, + "response": [] + }, + { + "name": "ContentStateUpdateV1", + "request": { + "method": "PATCH", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"userId\": \"{{user_id}}\",\n \"contents\": [\n {\n \"contentId\": \"{{content_id}}\",\n \"batchId\": \"{{batch_id}}\",\n \"status\": 2,\n \"courseId\": \"{{course_id}}\",\n \"lastAccessTime\": \"2020-11-23 12:58:35:179+0000\"\n }\n ]\n }\n}" + }, + "url": "{{host}}/api/course/v1/content/state/update" + }, + "response": [] + } + ] + }, + { + "name": "AggregateAPIs", + "item": [ + { + "name": "GroupActivityAggregateV1", + "request": { + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "{{kong_api_key}}", + "type": "text" + }, + { + "key": "X-Authenticated-User-token", + "value": "{{keycloak_access_token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"request\": {\n \"groupId\": \"{{group_id}}\",\n \"activityId\": \"{{activity_id}}\",\n \"activityType\": \"Course\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{host}}/api/data/v1/group/activity/agg" + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + " if (pm.environment.get(\"environment\") === \"local\") {", + " var baseURL = pm.environment.get(\"host\")", + " pm.variables.set(\"baseURL\", baseURL);", + " } else {", + " var baseURL = pm.environment.get(\"host\") + pm.variables.get(\"basePath\");", + " pm.variables.set(\"baseURL\", baseURL);", + " }", + "", + " function generateRandomBatchName() {", + " const adjectives = ['Advanced', 'Beginner', 'Intermediate', 'Expert', 'Pro', 'Novice', 'Skilled', 'Enthusiastic'];", + " const subjects = ['Math', 'Science', 'History', 'Literature', 'Programming', 'Languages', 'Art', 'Music'];", + " const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];", + " const randomSubject = subjects[Math.floor(Math.random() * subjects.length)];", + " const randomNumber = Math.floor(Math.random() * 1000);", + " ", + " return `${randomAdjective} ${randomSubject} Batch ${randomNumber}`;", + "}", + "", + "function generateRandomDescription() {", + " const phrases = [", + " 'Join this batch to enhance your knowledge and skills.',", + " 'In this batch, we explore various topics and concepts.',", + " 'Looking for an engaging learning experience? Join this batch now!',", + " 'We focus on interactive learning and collaborative discussions.',", + " 'This batch is open to learners of all levels.'", + " ];", + " ", + " const randomPhrase = phrases[Math.floor(Math.random() * phrases.length)];", + " return randomPhrase;", + "}", + "", + "const batchName = generateRandomBatchName();", + "const batchDescription = generateRandomDescription();", + "// Calculate the start date (current date - 5 days)", + "const currentDate = new Date();", + "const startDate = new Date(currentDate);", + "startDate.setDate(currentDate.getDate());", + "", + "// Calculate the end date (end of 3 months from current date)", + "const endDate = new Date(currentDate);", + "endDate.setMonth(currentDate.getMonth() + 3, 0); // Set to the last day of the third month", + "", + "// Format dates as strings (YYYY-MM-DD)", + "const formattedStartDate = startDate.toISOString().split('T')[0];", + "const formattedEndDate = endDate.toISOString().split('T')[0];", + "", + "// Get the current date", + "const currentUpdateDate = new Date();", + "", + "// Add 5 days to the current date", + "const updateDate = new Date(currentUpdateDate);", + "updateDate.setDate(currentUpdateDate.getDate() + 5);", + "", + "// Format the update date as a string (YYYY-MM-DD)", + "const formattedUpdateDate = updateDate.toISOString().split('T')[0];", + "", + "// Set the environment variable", + "pm.environment.set('batch_update_date', formattedUpdateDate);", + "", + "", + "// Set the environment variables", + "pm.environment.set('batch_start_date', formattedStartDate);", + "pm.environment.set('batch_end_date', formattedEndDate);", + "", + "", + "pm.environment.set('batch_name', batchName);", + "pm.environment.set('batch_description', batchDescription);", + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "refresh_token", + "value": "" + } + ] +} \ No newline at end of file diff --git a/api-tests/Collection/Lms_Environment.postman_environment.json b/api-tests/Collection/Lms_Environment.postman_environment.json new file mode 100644 index 000000000..c726ea44a --- /dev/null +++ b/api-tests/Collection/Lms_Environment.postman_environment.json @@ -0,0 +1,109 @@ +{ + "id": "16f7dd4a-cd4d-4e5f-b665-36b3c4af11e3", + "name": "Lms_Environment", + "values": [ + { + "key": "host", + "value": "https://dev.sunbirded.org", + "type": "default", + "enabled": true + }, + { + "key": "kong_api_key", + "value": "", + "enabled": true + }, + { + "key": "auth_client_id", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "auth_client_secret", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "keycloak_access_token", + "value": "", + "enabled": true + }, + { + "key": "user_id", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "course_id", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "batch_start_date", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "batch_end_date", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "batch_name", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "batch_description", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "batch_update_date", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "batch_id", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "password", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "username", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "asset_id", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "activity_id", + "value": "", + "type": "default", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2023-09-21T11:19:38.145Z", + "_postman_exported_using": "Postman/10.18.3" +} \ No newline at end of file diff --git a/auto_build_deploy b/auto_build_deploy index 0ad16fad0..8915f5bac 100644 --- a/auto_build_deploy +++ b/auto_build_deploy @@ -30,7 +30,7 @@ node('build-slave') { env.NODE_ENV = "build" print "Environment will be : ${env.NODE_ENV}" sh 'git log -1' - sh 'mvn clean install -DskipTests=true ' + sh "mvn clean install -DskipTests=true -DCLOUD_STORE_GROUP_ID=${params.cloud_store_group_id} -DCLOUD_STORE_ARTIFACT_ID=${params.cloud_store_artifact_id} -DCLOUD_STORE_VERSION=${params.cloud_store_version}" // stage Unit Tests diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/common/cacheloader/PageCacheLoaderService.java b/course-mw/course-actors-common/src/main/java/org/sunbird/common/cacheloader/PageCacheLoaderService.java index 8b2096412..dadafc656 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/common/cacheloader/PageCacheLoaderService.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/common/cacheloader/PageCacheLoaderService.java @@ -8,6 +8,7 @@ import org.sunbird.common.models.util.ActorOperations; import org.sunbird.common.models.util.JsonKey; import org.sunbird.common.models.util.LoggerUtil; +import org.sunbird.common.models.util.ProjectUtil; import org.sunbird.helper.ServiceFactory; import org.sunbird.learner.util.DataCacheHandler; @@ -18,7 +19,6 @@ public class PageCacheLoaderService implements Runnable { private CassandraOperation cassandraOperation = ServiceFactory.getInstance(); - private static final String KEY_SPACE_NAME = "sunbird"; private static boolean isCacheEnabled = false; private static LoggerUtil logger = new LoggerUtil(PageCacheLoaderService.class); // Boolean.parseBoolean(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_CACHE_ENABLE)); @@ -29,7 +29,7 @@ public class PageCacheLoaderService implements Runnable { public Map> cacheLoader(String tableName) { Map> map = new HashMap<>(); try { - Response response = cassandraOperation.getAllRecords(null, KEY_SPACE_NAME, tableName); + Response response = cassandraOperation.getAllRecords(null, ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), tableName); List> responseList = (List>) response.get(JsonKey.RESPONSE); if (CollectionUtils.isNotEmpty(responseList)) { diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/bulkupload/dao/impl/BulkUploadProcessDaoImpl.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/bulkupload/dao/impl/BulkUploadProcessDaoImpl.java index dcaabe374..2824fe6b2 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/bulkupload/dao/impl/BulkUploadProcessDaoImpl.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/bulkupload/dao/impl/BulkUploadProcessDaoImpl.java @@ -6,6 +6,8 @@ import org.sunbird.common.models.response.Response; import org.sunbird.common.models.util.JsonKey; import org.sunbird.common.models.util.LoggerUtil; +import org.sunbird.common.models.util.ProjectUtil; +import org.sunbird.common.models.util.TableNameUtil; import org.sunbird.common.request.RequestContext; import org.sunbird.helper.ServiceFactory; import org.sunbird.learner.actors.bulkupload.dao.BulkUploadProcessDao; @@ -22,15 +24,13 @@ public class BulkUploadProcessDaoImpl implements BulkUploadProcessDao { private CassandraOperation cassandraOperation = ServiceFactory.getInstance(); private ObjectMapper mapper = new ObjectMapper(); - private static final String KEYSPACE_NAME = "sunbird"; - private static final String TABLE_NAME = "bulk_upload_process"; private LoggerUtil logger = new LoggerUtil(BulkUploadProcessDaoImpl.class); @Override public Response create(BulkUploadProcess bulkUploadProcess, RequestContext requestContext) { Map map = mapper.convertValue(bulkUploadProcess, Map.class); map.put(JsonKey.CREATED_ON, new Timestamp(Calendar.getInstance().getTimeInMillis())); - Response response = cassandraOperation.insertRecord(requestContext, KEYSPACE_NAME, TABLE_NAME, map); + Response response = cassandraOperation.insertRecord(requestContext, ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.BULK_UPLOAD_PROCESS_TABLENAME, map); // need to send ID along with success msg response.put(JsonKey.ID, map.get(JsonKey.ID)); return response; @@ -43,12 +43,12 @@ public Response update(RequestContext requestContext, BulkUploadProcess bulkUplo map.remove(JsonKey.CREATED_ON); } map.put(JsonKey.LAST_UPDATED_ON, new Timestamp(Calendar.getInstance().getTimeInMillis())); - return cassandraOperation.updateRecord(requestContext, KEYSPACE_NAME, TABLE_NAME, map); + return cassandraOperation.updateRecord(requestContext, ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.BULK_UPLOAD_PROCESS_TABLENAME, map); } @Override public BulkUploadProcess read(RequestContext requestContext, String id) { - Response response = cassandraOperation.getRecordByIdentifier(requestContext, KEYSPACE_NAME, TABLE_NAME, id, null); + Response response = cassandraOperation.getRecordByIdentifier(requestContext, ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.BULK_UPLOAD_PROCESS_TABLENAME, id, null); List> list = (List>) response.get(JsonKey.RESPONSE); if (CollectionUtils.isEmpty(list)) { return null; diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManager.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManager.java index 862430da3..980b9854e 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManager.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManager.java @@ -123,7 +123,10 @@ public Map getQRCodeImageURLs(Set dialCodes, String chan Map resMap = new HashMap<>(); for(Map qrImageObj : qrCodeImagesList) { - resMap.put(qrImageObj.get("identifier").toString(), qrImageObj.get("imageUrl").toString()); + if(qrImageObj.get("imageUrl") != null ) + resMap.put(qrImageObj.get("identifier").toString(), qrImageObj.get("imageUrl").toString()); + else + resMap.put(qrImageObj.get("identifier").toString(), ""); } return resMap; } diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/DataCacheHandler.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/DataCacheHandler.java index f1ed0b045..b73f028a7 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/DataCacheHandler.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/DataCacheHandler.java @@ -4,6 +4,8 @@ import org.sunbird.cassandra.CassandraOperation; import org.sunbird.common.models.response.Response; import org.sunbird.common.models.util.JsonKey; +import org.sunbird.common.models.util.ProjectUtil; +import org.sunbird.common.models.util.TableNameUtil; import org.sunbird.common.models.util.LoggerUtil; import org.sunbird.helper.ServiceFactory; @@ -25,21 +27,20 @@ public class DataCacheHandler implements Runnable { private static Map> sectionMap = new ConcurrentHashMap<>(); private CassandraOperation cassandraOperation = ServiceFactory.getInstance(); - private static final String KEY_SPACE_NAME = "sunbird"; private LoggerUtil logger = new LoggerUtil(DataCacheHandler.class); @Override public void run() { logger.info(null, "DataCacheHandler:run: Cache refresh started."); - cache(pageMap, "page_management"); - cache(sectionMap, "page_section"); + cache(pageMap, TableNameUtil.PAGE_MANAGEMENT_TABLENAME); + cache(sectionMap, TableNameUtil.PAGE_SECTION_TABLENAME); logger.info(null, "DataCacheHandler:run: Cache refresh completed."); } @SuppressWarnings("unchecked") private void cache(Map> map, String tableName) { try { - Response response = cassandraOperation.getAllRecords(null, KEY_SPACE_NAME, tableName); + Response response = cassandraOperation.getAllRecords(null, ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), tableName); List> responseList = (List>) response.get(JsonKey.RESPONSE); if (null != responseList && !responseList.isEmpty()) { diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/Util.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/Util.java index 168111449..d97890dfd 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/Util.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/Util.java @@ -3,6 +3,8 @@ import org.apache.commons.lang3.StringUtils; import org.sunbird.common.models.util.JsonKey; import org.sunbird.common.models.util.LoggerUtil; +import org.sunbird.common.models.util.ProjectUtil; +import org.sunbird.common.models.util.TableNameUtil; import org.sunbird.common.request.Request; import org.sunbird.dto.SearchDTO; import org.sunbird.helper.CassandraConnectionManager; @@ -30,9 +32,6 @@ public final class Util { public static final Map dbInfoMap = new HashMap<>(); public static final int RECOMENDED_LIST_SIZE = 10; public static final int DEFAULT_ELASTIC_DATA_LIMIT = 10000; - public static final String KEY_SPACE_NAME = "sunbird"; - public static final String COURSE_KEY_SPACE_NAME = "sunbird_courses"; - public static final String DIALCODE_KEY_SPACE_NAME = "dialcodes"; private static Properties prop = new Properties(); private static LoggerUtil logger = new LoggerUtil(Util.class); @@ -46,30 +45,30 @@ private Util() {} /** This method will initialize the cassandra data base property */ private static void initializeDBProperty() { dbInfoMap.put( - JsonKey.LEARNER_COURSE_DB, getDbInfoObject(COURSE_KEY_SPACE_NAME, "user_enrolments")); + JsonKey.LEARNER_COURSE_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_COURSE_KEYSPACE), TableNameUtil.USER_ENROLLMENTS_TABLENAME)); dbInfoMap.put( - JsonKey.LEARNER_CONTENT_DB, getDbInfoObject(COURSE_KEY_SPACE_NAME, "user_content_consumption")); + JsonKey.LEARNER_CONTENT_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_COURSE_KEYSPACE), TableNameUtil.USER_CONTENT_CONSUMPTION_TABLENAME)); dbInfoMap.put( - JsonKey.COURSE_MANAGEMENT_DB, getDbInfoObject(KEY_SPACE_NAME, "course_management")); - dbInfoMap.put(JsonKey.PAGE_MGMT_DB, getDbInfoObject(KEY_SPACE_NAME, "page_management")); - dbInfoMap.put(JsonKey.PAGE_SECTION_DB, getDbInfoObject(KEY_SPACE_NAME, "page_section")); - dbInfoMap.put(JsonKey.SECTION_MGMT_DB, getDbInfoObject(KEY_SPACE_NAME, "page_section")); - dbInfoMap.put(JsonKey.ASSESSMENT_EVAL_DB, getDbInfoObject(KEY_SPACE_NAME, "assessment_eval")); - dbInfoMap.put(JsonKey.ASSESSMENT_ITEM_DB, getDbInfoObject(KEY_SPACE_NAME, "assessment_item")); + JsonKey.COURSE_MANAGEMENT_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.COURSE_MANAGEMENT_TABLENAME)); + dbInfoMap.put(JsonKey.PAGE_MGMT_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.PAGE_MANAGEMENT_TABLENAME)); + dbInfoMap.put(JsonKey.PAGE_SECTION_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.PAGE_SECTION_TABLENAME)); + dbInfoMap.put(JsonKey.SECTION_MGMT_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.PAGE_SECTION_TABLENAME)); + dbInfoMap.put(JsonKey.ASSESSMENT_EVAL_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.ASSESSMENT_EVAL_TABLENAME)); + dbInfoMap.put(JsonKey.ASSESSMENT_ITEM_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.ASSESSMENT_ITEM_TABLENAME)); dbInfoMap.put( - JsonKey.BULK_OP_DB, getDbInfoObject(COURSE_KEY_SPACE_NAME, "bulk_upload_process")); - dbInfoMap.put(JsonKey.COURSE_BATCH_DB, getDbInfoObject(COURSE_KEY_SPACE_NAME, "course_batch")); - dbInfoMap.put(JsonKey.CLIENT_INFO_DB, getDbInfoObject(KEY_SPACE_NAME, "client_info")); - dbInfoMap.put(JsonKey.USER_AUTH_DB, getDbInfoObject(KEY_SPACE_NAME, "user_auth")); + JsonKey.BULK_OP_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_COURSE_KEYSPACE), TableNameUtil.BULK_UPLOAD_PROCESS_TABLENAME)); + dbInfoMap.put(JsonKey.COURSE_BATCH_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_COURSE_KEYSPACE), TableNameUtil.COURSE_BATCH_TABLENAME)); + dbInfoMap.put(JsonKey.CLIENT_INFO_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.CLIENT_INFO_TABLENAME)); + dbInfoMap.put(JsonKey.USER_AUTH_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_KEYSPACE), TableNameUtil.USER_AUTH_TABLENAME)); dbInfoMap.put( JsonKey.SUNBIRD_COURSE_DIALCODES_DB, - getDbInfoObject(DIALCODE_KEY_SPACE_NAME, "dialcode_images")); + getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.DIALCODE_KEYSPACE), TableNameUtil.DIALCODE_IMAGES_TABLENAME)); dbInfoMap.put( - JsonKey.GROUP_ACTIVITY_DB, getDbInfoObject(COURSE_KEY_SPACE_NAME, "user_activity_agg")); + JsonKey.GROUP_ACTIVITY_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_COURSE_KEYSPACE), TableNameUtil.USER_ACTIVITY_AGG_TABLENAME)); dbInfoMap.put( - JsonKey.ASSESSMENT_AGGREGATOR_DB, getDbInfoObject(COURSE_KEY_SPACE_NAME, "assessment_aggregator")); - dbInfoMap.put(JsonKey.USER_ENROLMENTS_DB, getDbInfoObject(COURSE_KEY_SPACE_NAME, "user_enrolments")); + JsonKey.ASSESSMENT_AGGREGATOR_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_COURSE_KEYSPACE), TableNameUtil.ASSESSMENT_AGGREGATOR_TABLENAME)); + dbInfoMap.put(JsonKey.USER_ENROLMENTS_DB, getDbInfoObject(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_COURSE_KEYSPACE), TableNameUtil.USER_ENROLMENTS_TABLENAME)); } /** diff --git a/course-mw/sunbird-util/cache-utils/src/main/scala/org/sunbird/cache/util/RedisCacheUtil.scala b/course-mw/sunbird-util/cache-utils/src/main/scala/org/sunbird/cache/util/RedisCacheUtil.scala index f3b3f92b6..c5431c84c 100644 --- a/course-mw/sunbird-util/cache-utils/src/main/scala/org/sunbird/cache/util/RedisCacheUtil.scala +++ b/course-mw/sunbird-util/cache-utils/src/main/scala/org/sunbird/cache/util/RedisCacheUtil.scala @@ -1,10 +1,9 @@ package org.sunbird.cache.util import java.time.Duration - import org.apache.commons.lang3.StringUtils import org.sunbird.cache.platform.Platform -import org.sunbird.common.models.util.LoggerUtil +import org.sunbird.common.models.util.{JsonKey, LoggerUtil} import redis.clients.jedis.{Jedis, JedisPool, JedisPoolConfig} import scala.collection.JavaConverters._ @@ -19,9 +18,9 @@ class RedisCacheUtil { implicit val className = "org.sunbird.cache.connector.RedisConnector" - private val redis_host = Platform.getString("sunbird_redis_host", "localhost") - private val redis_port = Platform.getInteger("sunbird_redis_port", 6379) - private val index = Platform.getInteger("redis.dbIndex", 0) + private val redis_host = Platform.getString(JsonKey.REDIS_HOST_VALUE, "localhost") + private val redis_port = Platform.getInteger(JsonKey.REDIS_PORT_VALUE, 6379) + private val index = Platform.getInteger(JsonKey.REDIS_INDEX_VALUE, 0) println("=====redis_host=====" + redis_host) println("=====redis index=====" + index) diff --git a/course-mw/sunbird-util/sunbird-cache-utils/src/main/java/org/sunbird/redis/RedisConnectionManager.java b/course-mw/sunbird-util/sunbird-cache-utils/src/main/java/org/sunbird/redis/RedisConnectionManager.java index c522dae6a..b52ce4719 100644 --- a/course-mw/sunbird-util/sunbird-cache-utils/src/main/java/org/sunbird/redis/RedisConnectionManager.java +++ b/course-mw/sunbird-util/sunbird-cache-utils/src/main/java/org/sunbird/redis/RedisConnectionManager.java @@ -12,10 +12,10 @@ import org.sunbird.common.models.util.ProjectUtil; public class RedisConnectionManager { - private static String host = ProjectUtil.getConfigValue("sunbird_redis_host"); - private static String port = ProjectUtil.getConfigValue("sunbird_redis_port"); + private static String host = ProjectUtil.getConfigValue(JsonKey.REDIS_HOST_VALUE); + private static String port = ProjectUtil.getConfigValue(JsonKey.REDIS_PORT_VALUE); private static Boolean isRedisCluster = host.contains(",") ? true : false; - private static String scanInterval = ProjectUtil.getConfigValue("sunbird_redis_scan_interval"); + private static String scanInterval = ProjectUtil.getConfigValue(JsonKey.SUNBIRD_REDIS_SCAN_INTERVAL); private static int poolsize = Integer.valueOf(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_REDIS_CONN_POOL_SIZE)); private static RedissonClient client = null; diff --git a/course-mw/sunbird-util/sunbird-cassandra-utils/src/test/java/org/sunbird/cassandraimpl/CassandraDACImplTest.java b/course-mw/sunbird-util/sunbird-cassandra-utils/src/test/java/org/sunbird/cassandraimpl/CassandraDACImplTest.java index 5aca0b154..fda91081d 100644 --- a/course-mw/sunbird-util/sunbird-cassandra-utils/src/test/java/org/sunbird/cassandraimpl/CassandraDACImplTest.java +++ b/course-mw/sunbird-util/sunbird-cassandra-utils/src/test/java/org/sunbird/cassandraimpl/CassandraDACImplTest.java @@ -18,6 +18,9 @@ import org.sunbird.BaseTest; import org.sunbird.cassandra.CassandraOperation; import org.sunbird.common.models.response.Response; +import org.sunbird.common.models.util.JsonKey; +import org.sunbird.common.models.util.ProjectUtil; +import org.sunbird.common.models.util.TableNameUtil; import org.sunbird.common.request.Request; import org.sunbird.common.responsecode.ResponseCode; import org.sunbird.helper.CassandraConnectionManager; @@ -35,9 +38,9 @@ @PowerMockIgnore({"jdk.internal.reflect.*", "javax.management.*", "sun.security.ssl.*", "javax.net.ssl.*" , "javax.crypto.*"}) public class CassandraDACImplTest extends BaseTest { - String keyspace = "sunbird_courses"; - String table = "assessment_aggregator"; - String user_consumption_table = "user_content_consumption"; + String keyspace = ProjectUtil.getConfigValue(JsonKey.SUNBIRD_COURSE_KEYSPACE); + String table = TableNameUtil.ASSESSMENT_AGGREGATOR_TABLENAME; + String user_consumption_table = TableNameUtil.USER_CONTENT_CONSUMPTION_TABLENAME; Timestamp timestamp = new Timestamp(System.currentTimeMillis()); @Mock CassandraConnectionManager connectionManager; diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/pom.xml b/course-mw/sunbird-util/sunbird-platform-core/common-util/pom.xml index d3a23b85f..518e96ec7 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/pom.xml +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/pom.xml @@ -16,6 +16,9 @@ 2.22.0 2.0.7 2.0.0-beta.5 + org.sunbird + cloud-store-sdk + 1.4.6 @@ -67,12 +70,6 @@ resteasy-client 3.11.3.Final - - - com.microsoft.azure - azure-storage - 5.4.0 - org.apache.velocity @@ -217,9 +214,9 @@ 18.0 - org.sunbird - cloud-store-sdk - 1.4.4 + ${CLOUD_STORAGE_GROUP_ID} + ${CLOUD_STORE_ARTIFACT_ID} + ${CLOUD_STORE_VERSION} com.sun.jersey @@ -267,7 +264,7 @@ - + cloud-store https://oss.sonatype.org/content/repositories/orgsunbird-1021 diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java index c711660f4..727e450bb 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java @@ -15,6 +15,7 @@ public final class JsonKey { public static final String MW_SYSTEM_PORT = "sunbird_mw_system_port"; public static final String ACCOUNT_KEY = "sunbird_account_key"; public static final String ACCOUNT_NAME = "sunbird_account_name"; + public static final String ACCOUNT_ENDPOINT = "sunbird_account_endpoint"; public static final String DOWNLOAD_LINK_EXPIRY_TIMEOUT = "download_link_expiry_timeout"; public static final String SIGNED_URL = "signedUrl"; public static final String ACTION_NAME = "actionName"; @@ -583,5 +584,19 @@ public final class JsonKey { public static final String CONTENT_LENGTH = "Content-Length"; + //#Release-5.4.0 - LR-511 + public static final String SUNBIRD_KEYSPACE = "sunbird_keyspace"; + public static final String SUNBIRD_COURSE_KEYSPACE ="sunbird_course_keyspace"; + public static final String DIALCODE_KEYSPACE = "dialcode_keyspace"; + public static final String REDIS_HOST_VALUE = "sunbird_redis_host"; + public static final String REDIS_PORT_VALUE = "sunbird_redis_port"; + public static final String REDIS_INDEX_VALUE = "redis.dbIndex"; + public static final String SUNBIRD_REDIS_SCAN_INTERVAL = "sunbird_redis_scan_interval"; + public static final String ES_COURSE_INDEX = "es_course_index"; + public static final String ES_COURSE_BATCH_INDEX = "es_course_batch_index"; + public static final String ES_USER_INDEX = "es_user_index"; + public static final String ES_ORGANISATION_INDEX = "es_organisation_index"; + public static final String ES_USER_COURSES_INDEX = "es_user_courses_index"; + private JsonKey() {} } diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/ProjectUtil.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/ProjectUtil.java index eaaf4c606..deb954875 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/ProjectUtil.java +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/ProjectUtil.java @@ -22,6 +22,7 @@ import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; import org.sunbird.common.exception.ProjectCommonException; +import org.sunbird.common.models.util.url.EsConfigUtil; import org.sunbird.common.request.Request; import org.sunbird.common.responsecode.ResponseCode; @@ -370,22 +371,11 @@ public String getIndexName() { * @author Manzarul */ public enum EsType { - course("cbatch"), - courseBatch("course-batch"), - content("content"), - user("user"), - organisation("org"), - usercourses("user-courses"), - usernotes("usernotes"), - userprofilevisibility("userprofilevisibility"), - telemetry("telemetry"), - location("location"), - announcementType("announcementtype"), - announcement("announcement"), - metrics("metrics"), - cbatchstats("cbatchstats"), - cbatchassessment("cbatch-assessment"), - userfeed("userfeed"); + course(EsConfigUtil.getConfigValue(JsonKey.ES_COURSE_INDEX)), + courseBatch(EsConfigUtil.getConfigValue(JsonKey.ES_COURSE_BATCH_INDEX)), + user(EsConfigUtil.getConfigValue(JsonKey.ES_USER_INDEX)), + organisation(EsConfigUtil.getConfigValue(JsonKey.ES_ORGANISATION_INDEX)), + usercourses(EsConfigUtil.getConfigValue(JsonKey.ES_USER_COURSES_INDEX)); private String typeName; @@ -525,21 +515,6 @@ public String getVal() { } } - /** @author Manzarul */ - public enum AzureContainer { - userProfileImg("userprofileimg"), - orgImage("orgimg"); - private String name; - - private AzureContainer(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } - public static VelocityContext getContext(Map map) { propertiesCache = PropertiesCache.getInstance(); VelocityContext context = new VelocityContext(); diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/TableNameUtil.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/TableNameUtil.java new file mode 100644 index 000000000..2969607af --- /dev/null +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/TableNameUtil.java @@ -0,0 +1,20 @@ +package org.sunbird.common.models.util; + +public class TableNameUtil { + public static final String USER_ENROLLMENTS_TABLENAME = "user_enrolments"; + public static final String USER_CONTENT_CONSUMPTION_TABLENAME = "user_content_consumption"; + public static final String COURSE_MANAGEMENT_TABLENAME = "course_management"; + public static final String PAGE_MANAGEMENT_TABLENAME = "page_management"; + public static final String PAGE_SECTION_TABLENAME="page_section"; + public static final String ASSESSMENT_EVAL_TABLENAME="assessment_eval"; + public static final String ASSESSMENT_ITEM_TABLENAME="assessment_item"; + public static final String BULK_UPLOAD_PROCESS_TABLENAME="bulk_upload_process"; + public static final String COURSE_BATCH_TABLENAME="course_batch"; + public static final String CLIENT_INFO_TABLENAME="client_info"; + public static final String USER_AUTH_TABLENAME="user_auth"; + public static final String DIALCODE_IMAGES_TABLENAME="dialcode_images"; + public static final String USER_ACTIVITY_AGG_TABLENAME="user_activity_agg"; + public static final String ASSESSMENT_AGGREGATOR_TABLENAME= "assessment_aggregator"; + public static final String USER_ENROLMENTS_TABLENAME="user_enrolments"; + +} \ No newline at end of file diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/url/EsConfigUtil.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/url/EsConfigUtil.java new file mode 100644 index 000000000..47fd9fe46 --- /dev/null +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/url/EsConfigUtil.java @@ -0,0 +1,15 @@ +package org.sunbird.common.models.util.url; + +import org.apache.commons.lang.StringUtils; + +import static org.sunbird.common.models.util.ProjectUtil.propertiesCache; + +public class EsConfigUtil { + + public static String getConfigValue(String key) { + if (StringUtils.isNotBlank(System.getenv(key))) { + return System.getenv(key); + } + return propertiesCache.readProperty(key); + } +} diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/util/CloudStorageUtil.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/util/CloudStorageUtil.java index adf7fd5ae..c3796e20b 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/util/CloudStorageUtil.java +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/util/CloudStorageUtil.java @@ -21,7 +21,7 @@ public class CloudStorageUtil { private static final int STORAGE_SERVICE_API_RETRY_COUNT = 3; private static final Map storageServiceMap = new HashMap<>(); - + public static String upload( String storageType, String container, String objectKey, String filePath) { @@ -51,26 +51,31 @@ public static String getSignedUrl( Some.apply("r"), Some.apply("application/pdf")); } - private static BaseStorageService getStorageService(String storageType) { - String storageKey = PropertiesCache.getInstance().getProperty(JsonKey.ACCOUNT_NAME); - String storageSecret = PropertiesCache.getInstance().getProperty(JsonKey.ACCOUNT_KEY); - return getStorageService(storageType, storageKey, storageSecret); - } + + private static BaseStorageService getStorageService(String storageType) { + String storageKey = PropertiesCache.getInstance().getProperty(JsonKey.ACCOUNT_NAME); + String storageSecret = PropertiesCache.getInstance().getProperty(JsonKey.ACCOUNT_KEY); + return getStorageService(storageType, storageKey, storageSecret); + } + private static BaseStorageService getStorageService( - String storageType, String storageKey, String storageSecret) { - String compositeKey = storageType + "-" + storageKey; - if (storageServiceMap.containsKey(compositeKey)) { - return storageServiceMap.get(compositeKey); - } - synchronized (CloudStorageUtil.class) { - StorageConfig storageConfig = - new StorageConfig(storageType, storageKey, storageSecret); - BaseStorageService storageService = StorageServiceFactory.getStorageService(storageConfig); - storageServiceMap.put(compositeKey, storageService); - } - return storageServiceMap.get(compositeKey); - } + String storageType, String storageKey, String storageSecret) { + String compositeKey = storageType + "-" + storageKey; + scala.Option storageEndpoint = scala.Option.apply(PropertiesCache.getInstance().getProperty(JsonKey.ACCOUNT_ENDPOINT)); + scala.Option storageRegion = scala.Option.apply(""); + if (storageServiceMap.containsKey(compositeKey)) { + return storageServiceMap.get(compositeKey); + } + synchronized (CloudStorageUtil.class) { + StorageConfig storageConfig = + new StorageConfig(storageType, storageKey, storageSecret,storageEndpoint,storageRegion); + BaseStorageService storageService = StorageServiceFactory.getStorageService(storageConfig); + storageServiceMap.put(compositeKey, storageService); + } + return storageServiceMap.get(compositeKey); + } + private static int getTimeoutInSeconds() { String timeoutInSecondsStr = ProjectUtil.getConfigValue(JsonKey.DOWNLOAD_LINK_EXPIRY_TIMEOUT); diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties index 73a1cbd13..2b743965c 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties @@ -45,7 +45,7 @@ sunbird_url_shortner_access_token= #Telemetry producer related info telemetry_pdata_id=local.sunbird.learning.service telemetry_pdata_pid=learning-service -telemetry_pdata_ver=5.3.0 +telemetry_pdata_ver=5.4.0 #elastic search top n result count for telemetry searchTopN=5 # Sunbird lms telemetry url @@ -75,7 +75,7 @@ sunbird_health_check_enable=true sunbird_sync_read_wait_time=1500 sunbird_gzip_size_threshold=262144 sunbird_redis_port=6379 -sunbird_redis_host=127.0.0.1 +sunbird_redis_host=localhost sunbird_redis_scan_interval=2000 sunbird_redis_connection_pool_size=250 #kafka_topics_instruction=local.coursebatch.job.request @@ -107,10 +107,21 @@ cloud_store_base_path_placeholder=CLOUD_BASE_PATH content_service_mock_enabled=false #Release-5.2.0 - LR-325 -sunbird_dial_service_base_url=https://dev.lern.sunbird.org -sunbird_dial_service_search_url=/api/dialcode/v1/search +sunbird_dial_service_base_url=http://dial-service.learn.svc.cluster.local:9000 +sunbird_dial_service_search_url=/dialcode/v3/search #Release-5.3.0 - LR-539 exhaust_api_base_url=https://dev.lern.sunbird.org exhaust_api_submit_endpoint=/api/dataset/v1/request/submit -exhaust_api_list_endpoint=/api/dataset/v1/request/list \ No newline at end of file +exhaust_api_list_endpoint=/api/dataset/v1/request/list + +#Release-5.4.0 - LR-511 +sunbird_keyspace=sunbird +sunbird_course_keyspace=sunbird_courses +dialcode_keyspace=dialcodes +redis.dbIndex=0 +es_course_index=cbatch +es_course_batch_index=course-batch +es_user_index=user +es_organisation_index=org +es_user_courses_index=user-courses \ No newline at end of file diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/util/ProjectUtilTest.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/util/ProjectUtilTest.java index 256220330..77d3d4199 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/util/ProjectUtilTest.java +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/test/java/org/sunbird/common/models/util/ProjectUtilTest.java @@ -247,14 +247,11 @@ public void testReportTrackingStatusSuccess() { @Test public void testEsTypeSuccess() { - assertEquals("content", ProjectUtil.EsType.content.getTypeName()); assertEquals("cbatch", ProjectUtil.EsType.course.getTypeName()); assertEquals("course-batch", ProjectUtil.EsType.courseBatch.getTypeName()); assertEquals("user", ProjectUtil.EsType.user.getTypeName()); assertEquals("org", ProjectUtil.EsType.organisation.getTypeName()); assertEquals("user-courses", ProjectUtil.EsType.usercourses.getTypeName()); - assertEquals("usernotes", ProjectUtil.EsType.usernotes.getTypeName()); - assertEquals("userprofilevisibility", ProjectUtil.EsType.userprofilevisibility.getTypeName()); } @Test @@ -335,8 +332,6 @@ public void testStatusSuccess() { assertEquals(0, ProjectUtil.Status.INACTIVE.getValue()); assertEquals(false, ProjectUtil.ActiveStatus.INACTIVE.getValue()); assertEquals(true, ProjectUtil.ActiveStatus.ACTIVE.getValue()); - assertEquals("orgimg", ProjectUtil.AzureContainer.orgImage.getName()); - assertEquals("userprofileimg", ProjectUtil.AzureContainer.userProfileImg.getName()); } @Test diff --git a/service/dependency-reduced-pom.xml b/service/dependency-reduced-pom.xml index c0f9ffb95..fd4449d2e 100644 --- a/service/dependency-reduced-pom.xml +++ b/service/dependency-reduced-pom.xml @@ -227,7 +227,7 @@ 2.11.8 1.0.0-beta5 - 2.4.6 + 2.7.2