Skip to content
Snippets Groups Projects
Commit b03dca41 authored by Pratiksha Shedge's avatar Pratiksha Shedge Committed by Konstantin Khottchenkov
Browse files

test: added tests to add group of users to subproject

parent 0c7a3933
No related branches found
No related tags found
1 merge request!531test: added tests to add group of users to subproject
......@@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
# IDE configurations
.vscode
dist/
......
......@@ -15,7 +15,8 @@ Postman collection with API requests that check the basic functionality of the s
| legaltag01 | valid legal tag registered in Legal Service | Required |
| legaltag02 | another valid legal tag registered in Legal Service | Required |
| newuser | valid user registered in data partition other then STOKEN issued for | Required if _VCS_Provider_ is not set |
| VCS_Provider | possible values are ```true``` for script or ```gitlab``` for Newman. Need to skip USER and IMPTOKEN API endpoints test | Required if _newuser_ is not set |
| newusergroup | valid user group registered in data partition | Required if _VCS_Provider_ is not set |
| VCS_Provider | possible values are ```true``` for script or ```gitlab``` for Newman. It is needed to skip USER and IMPTOKEN API endpoints test | Required if _newuser_ and/or _newusergroup_ is not set |
| SVC_API_KEY | historical variables and could be any string | Optional |
| DE_APP_KEY | historical variables and could be any string | Optional |
---
......
{
"info": {
"_postman_id": "caf7d857-0f63-4333-9f09-2a30c8b2c3ee",
"name": "SDMS-E2E ver.M12 - Release 0.15",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
"_postman_id": "0ee111ff-dc2f-4b21-a696-b6578ee609bc",
"name": "SDMS-E2E ver.M14 - Release 0.17",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "11702291"
},
"item": [
{
......@@ -12435,6 +12436,71 @@
},
"response": []
},
{
"name": "USER ADD",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (responseCode.code != 200) {",
" _.retryOnFailure(postman, pm.response.code, request.name, pm.environment.get(\"maxAmountOfRetries\"));",
"",
"} else {",
" pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
" });",
"",
" // Reset environment variables if _.retryOnFailure function was used before",
" var key = request.name + '_counter';",
" pm.environment.unset(key);",
" postman.setEnvironmentVariable('execCounter', 1)",
"}",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{STOKEN}}"
},
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "x-api-key",
"value": "{{SVC_API_KEY}}"
},
{
"key": "appkey",
"value": "{{DE_APP_KEY}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"email\": \"{{newuser}}\",\n\t\"path\": \"sd://{{tenant}}/{{subproject}}\",\n\t\"group\": \"admin\"\n}"
},
"url": {
"raw": "{{SVC_URL}}/user",
"host": [
"{{SVC_URL}}"
],
"path": [
"user"
]
}
},
"response": []
},
{
"name": "USER LIST",
"event": [
......@@ -12453,19 +12519,18 @@
" pm.response.to.have.status(200);",
" });",
"",
" // can be re-enabled after 01/22 when sauth v1 will be dismissed",
" // pm.test(\"Find test account in user list\", function () {",
" // var list = jsonData.length;",
" // var check = 'false';",
" // for(var i = 0; i < list; i++) {",
" // if(jsonData[i][0] == pm.environment.get('newuser')) {",
" // if(jsonData[i][1] == 'editor') {",
" // check = 'true';",
" // }",
" // }",
" // }",
" // pm.expect(check).to.eql('true');",
" // });",
" pm.test(\"Find test account in user list\", function () {",
" var list = jsonData.length;",
" var check = 'false';",
" for(var i = 0; i < list; i++) {",
" if(jsonData[i][0] == pm.environment.get('newuser')) {",
" if(jsonData[i][1] == 'admin') {",
" check = 'true';",
" }",
" }",
" }",
" pm.expect(check).to.eql('true');",
" });",
"",
" // Reset environment variables if _.retryOnFailure function was used before",
" var key = request.name + '_counter';",
......@@ -12659,28 +12724,26 @@
"response": []
},
{
"name": "USER ADD",
"name": "USER ADD GROUP",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// wokaround. line 2 should be removed in normal life",
"if (pm.environment.get(\"serviceCloudProvider\") === 'azure') {",
" if (responseCode.code != 200) {",
" _.retryOnFailure(postman, pm.response.code, request.name, pm.environment.get(\"maxAmountOfRetries\"));",
"if ((responseCode.code != 200) && (responseCode.code != 409)) {",
" _.retryOnFailure(postman, pm.response.code, request.name, pm.environment.get(\"maxAmountOfRetries\"));",
"",
" } else {",
" pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
" });",
"} else {",
" pm.test(\"Status code is 200 or 409\", function () {",
" pm.expect(pm.response.code).to.be.oneOf([200,409]);",
" });",
"",
" // Reset environment variables if _.retryOnFailure function was used before",
" var key = request.name + '_counter';",
" pm.environment.unset(key);",
" postman.setEnvironmentVariable('execCounter', 1)",
" }",
"}"
" // Reset environment variables if _.retryOnFailure function was used before",
" var key = request.name + '_counter';",
" pm.environment.unset(key);",
" postman.setEnvironmentVariable('execCounter', 1)",
"}",
""
],
"type": "text/javascript"
}
......@@ -12711,7 +12774,149 @@
],
"body": {
"mode": "raw",
"raw": "{\n\t\"email\": \"{{newuser}}\",\n\t\"path\": \"sd://{{tenant}}/{{subproject}}\",\n\t\"group\": \"admin\"\n}"
"raw": "{\n\t\"email\": \"{{newuser_group}}\",\n\t\"path\": \"sd://{{tenant}}/{{subproject}}\",\n\t\"group\": \"admin\"\n}"
},
"url": {
"raw": "{{SVC_URL}}/user",
"host": [
"{{SVC_URL}}"
],
"path": [
"user"
]
}
},
"response": []
},
{
"name": "USER LIST GROUP",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (responseCode.code != 200) {",
" console.log(pm.response.text())",
" _.retryOnFailure(postman, pm.response.code, request.name, pm.environment.get(\"maxAmountOfRetries\"));",
"",
"} else {",
" var jsonData = pm.response.json();",
"",
" pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
" });",
"",
" pm.test(\"Find deleted account in user list\", function () {",
" var list = jsonData.length;",
" var check = 'not found';",
" for(var i = 0; i < list; i++) {",
" if(jsonData[i][0] == pm.environment.get('newuser_group')) {",
" check = 'found';",
" console.log('Match')",
" }",
" }",
" pm.expect(check).to.eql('found');",
" });",
"",
" // Reset environment variables if _.retryOnFailure function was used before",
" var key = request.name + '_counter';",
" pm.environment.unset(key);",
" postman.setEnvironmentVariable('execCounter', 1)",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{STOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "x-api-key",
"value": "{{SVC_API_KEY}}"
},
{
"key": "appkey",
"value": "{{DE_APP_KEY}}",
"type": "text"
}
],
"url": {
"raw": "{{SVC_URL}}/user?sdpath=sd://{{tenant}}/{{subproject}}",
"host": [
"{{SVC_URL}}"
],
"path": [
"user"
],
"query": [
{
"key": "sdpath",
"value": "sd://{{tenant}}/{{subproject}}"
}
]
}
},
"response": []
},
{
"name": "USER REMOVE GROUP",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (responseCode.code != 200) {",
" console.log(pm.response.text())",
" _.retryOnFailure(postman, pm.response.code, request.name, pm.environment.get(\"maxAmountOfRetries\"));",
"",
"} else {",
" pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
" });",
"",
" // Reset environment variables if _.retryOnFailure function was used before",
" var key = request.name + '_counter';",
" pm.environment.unset(key);",
" postman.setEnvironmentVariable('execCounter', 1)",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"header": [
{
"key": "Authorization",
"value": "Bearer {{STOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "x-api-key",
"value": "{{SVC_API_KEY}}"
},
{
"key": "appkey",
"value": "{{DE_APP_KEY}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"email\": \"{{newuser_group}}\",\n\t\"path\": \"sd://{{tenant}}/{{subproject}}\"\n}"
},
"url": {
"raw": "{{SVC_URL}}/user",
......@@ -12724,6 +12929,84 @@
}
},
"response": []
},
{
"name": "USER LIST AFTER REMOVE GROUP",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (responseCode.code != 200) {",
" console.log(pm.response.text())",
" _.retryOnFailure(postman, pm.response.code, request.name, pm.environment.get(\"maxAmountOfRetries\"));",
"",
"} else {",
" var jsonData = pm.response.json();",
"",
" pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
" });",
"",
" pm.test(\"Find deleted account in user list\", function () {",
" var list = jsonData.length;",
" var check = 'not found';",
" for(var i = 0; i < list; i++) {",
" if(jsonData[i][0] == pm.environment.get('newuser_group')) {",
" check = 'found';",
" }",
" }",
" pm.expect(check).to.eql('not found');",
" });",
"",
" // Reset environment variables if _.retryOnFailure function was used before",
" var key = request.name + '_counter';",
" pm.environment.unset(key);",
" postman.setEnvironmentVariable('execCounter', 1)",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{STOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "x-api-key",
"value": "{{SVC_API_KEY}}"
},
{
"key": "appkey",
"value": "{{DE_APP_KEY}}",
"type": "text"
}
],
"url": {
"raw": "{{SVC_URL}}/user?sdpath=sd://{{tenant}}/{{subproject}}",
"host": [
"{{SVC_URL}}"
],
"path": [
"user"
],
"query": [
{
"key": "sdpath",
"value": "sd://{{tenant}}/{{subproject}}"
}
]
}
},
"response": []
}
]
},
......
{
"id": "79282296-739d-4c80-a65c-86e676354e5e",
"id": "8f901ba8-9441-41ea-a086-e0a04a716b3e",
"name": "seistore-test-e2e-gitlab-dafaults",
"values": [
{
......@@ -47,6 +47,12 @@
"value": "#{NEWUSEREMAIL}#",
"enabled": true
},
{
"key": "newuser_group",
"value": "#{NEWUSERGROUP}#",
"type": "default",
"enabled": true
},
{
"key": "DE_APP_KEY",
"value": "#{DE_APP_KEY}#",
......@@ -64,6 +70,6 @@
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2021-12-03T15:32:49.050Z",
"_postman_exported_using": "Postman/9.3.0"
"_postman_exported_at": "2022-09-21T08:35:08.061Z",
"_postman_exported_using": "Postman/9.31.9"
}
\ No newline at end of file
......@@ -20,8 +20,8 @@ usage() {
printf "\n[USAGE] ./e2e/tests/run_e2e_tests.sh --seistore-svc-url=... " \
"--seistore-svc-api-key=... --user-idtoken=... --tenant=..." \
"--datapartition=... --legaltag01=... --legaltag02=... " \
"--newuser(optional)=... --VCS-provider(optional)=... --de-app-key(optional)=... " \
"--admin-email(optional)=... --subproject(optional)=... \n "
"--newuser(optional)=... --newusergroup(optional)=... --VCS-provider(optional)=... " \
"--admin-email(optional)=... --de-app-key(optional)=... --subproject(optional)=... \n "
printf "\n[ERROR] %s\n" "$1"
}
......@@ -39,7 +39,8 @@ usage() {
# argument [datapartition] data partition id - required
# argument [legaltag01] test legal tag - required
# argument [legaltag02] test legal tag - required
# argument [newuser] user email for a new user to add partition id - required if [VCS-Provider] is not 'gitlab'
# argument [newuser] user email for a new user to be added into subproject - required if [VCS-Provider] is not 'gitlab'
# argument [newusergroup] user group email for a group to be added into subproject - required if [VCS-Provider] is not 'gitlab'
# argument [VCS-Provider] valid value is 'gitlab'. Provided will skip USER and IMPTOKEN API endpoints tests - optional
# argument [de-app-key] DELFI application key - optional
# argument [admin-email] user credentail email - optional (deprecated)
......@@ -79,6 +80,10 @@ case $i in
newuser="${i#*=}"
shift
;;
--newusergroup=*)
newusergroup="${i#*=}"
shift
;;
--de-app-key=*)
de_app_key="${i#*=}"
shift
......@@ -115,6 +120,7 @@ if [[ "${VCS_Provider}" == true || "${VCS_Provider}" == "true" || "${VCS_Provide
VCS_Provider="gitlab"
else
if [ -z "${newuser}" ]; then usage "newuser not defined" && exit 1; fi
if [ -z "${newusergroup}" ]; then usage "newusergroup not defined" && exit 1; fi
VCS_Provider="any"
fi
......@@ -143,6 +149,7 @@ printf "%s\n" "datapartition = ${datapartition}"
printf "%s\n" "legaltag01 = ${legaltag01}"
printf "%s\n" "legaltag02 = ${legaltag02}"
printf "%s\n" "newuser = ${newuser}"
printf "%s\n" "newusergroup = ${newusergroup}"
printf "%s\n" "VCS_Provider = ${VCS_Provider}"
printf "%s\n" "subproject = ${subproject}"
printf "%s\n" "--------------------------------------------"
......@@ -158,6 +165,7 @@ sed -i "s/#{DATAPARTITION}#/${datapartition}/g" ./tests/e2e/postman_env.json
sed -i "s/#{LEGALTAG01}#/${legaltag01}/g" ./tests/e2e/postman_env.json
sed -i "s/#{LEGALTAG02}#/${legaltag02}/g" ./tests/e2e/postman_env.json
sed -i "s/#{NEWUSEREMAIL}#/${newuser}/g" ./tests/e2e/postman_env.json
sed -i "s/#{NEWUSERGROUP}#/${newusergroup}/g" ./tests/e2e/postman_env.json
sed -i "s/#{VCS_PROVIDER}#/${VCS_Provider}/g" ./tests/e2e/postman_env.json
sed -i "s/#{DE_APP_KEY}#/${de_app_key}/g" ./tests/e2e/postman_env.json
sed -i "s/#{SUBPROJECT}#/${subproject}/g" ./tests/e2e/postman_env.json
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment