From ed0abae0169148452e3235376e8993915cf6aab0 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Thu, 11 Jan 2024 18:16:00 +1100 Subject: [PATCH] move test definitions --- .gitignore | 1 + group-test.json | 108 --------------- permissions-test.json | 75 ----------- safes-test.json | 120 ----------------- test-random.json | 67 ---------- tests.json | 296 ------------------------------------------ user-test.json | 66 ---------- 7 files changed, 1 insertion(+), 732 deletions(-) delete mode 100644 group-test.json delete mode 100644 permissions-test.json delete mode 100644 safes-test.json delete mode 100644 test-random.json delete mode 100644 tests.json delete mode 100644 user-test.json diff --git a/.gitignore b/.gitignore index e69de29..7542fb9 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +tests/*.json \ No newline at end of file diff --git a/group-test.json b/group-test.json deleted file mode 100644 index 7fa593e..0000000 --- a/group-test.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "name": "CBS group testing", - "testCases": { - "test1": { - "path": "/api/login", - "method": "POST", - "description": "Perform login", - "body": { - "username": "Administrator", - "password": "Password123" - }, - "expect": { - "header": { - "contains": { - "http_status": "200", - "Content-Type": "application/json" - } - }, - "body": { - "hasKeys": ["access_token"] - } - } - }, - "test2": { - "path": "/api/admin/groups", - "method": "GET", - "description": "get group listing", - "expect": { - "header": { - "contains": { - "http_status": "200" - } - }, - "body": { - "hasKeys": ["groupName"], - "contains": { - "message": "success" - } - } - } - }, - "test3": { - "path": "/api/admin/group/add", - "disabled": true, - "method": "POST", - "description": "add new local group", - "body": { - "groupName": "test local group", - "ldapGroup": false - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test4": { - "path": "/api/admin/groups", - "method": "GET", - "description": "get group listing again", - "expect": { - "header": { - "contains": { - "http_status": "200" - } - }, - "body": { - "hasKeys": ["groupName"], - "contains": { - "message": "success" - } - } - } - }, - "test5": { - "path": "/api/admin/group/delete", - "method": "POST", - "description": "remove new local group", - "body": { - "groupName": "test local group", - "ldapGroup": false - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - } - }, - "url": "https://10.63.39.130:8443", - "insecure": true, - "header": { - "Content-Type": "application/json", - "Authorization": "Bearer %ACCESS_TOKEN%" - }, - "capture": { - "test1": { - "body": { - "access_token": "%ACCESS_TOKEN%" - } - } - } -} - \ No newline at end of file diff --git a/permissions-test.json b/permissions-test.json deleted file mode 100644 index da27621..0000000 --- a/permissions-test.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "CBS permissions testing", - "testCases": { - "test1": { - "path": "/api/login", - "method": "POST", - "description": "Perform login", - "body": { - "username": "Administrator", - "password": "Password123" - }, - "expect": { - "header": { - "contains": { - "http_status": "200", - "Content-Type": "application/json" - } - }, - "body": { - "hasKeys": ["access_token"] - } - } - }, - "test2": { - "path": "/api/admin/permissions", - "method": "GET", - "description": "get list of permissions", - "expect": { - "header": { - "contains": { - "http_status": "200" - } - }, - "body": { - "hasKeys": ["permissionId"], - "contains": { - "message": "success" - } - } - } - }, - "test3": { - "path": "/api/admin/permission/add", - "method": "POST", - "description": "create new permission", - "body": { - "Description": "Readonly access to default safe", - "safeId": 1, - "userId": 2, - "readOnly": true - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - } - }, - "url": "https://10.63.39.130:8443", - "insecure": true, - "header": { - "Content-Type": "application/json", - "Authorization": "Bearer %ACCESS_TOKEN%" - }, - "capture": { - "test1": { - "body": { - "access_token": "%ACCESS_TOKEN%" - } - } - } -} - \ No newline at end of file diff --git a/safes-test.json b/safes-test.json deleted file mode 100644 index 6501740..0000000 --- a/safes-test.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "name": "CBS safes testing", - "testCases": { - "test1": { - "path": "/api/login", - "method": "POST", - "description": "Perform login", - "body": { - "username": "Administrator", - "password": "Password123" - }, - "expect": { - "header": { - "contains": { - "http_status": "200", - "Content-Type": "application/json" - } - }, - "body": { - "hasKeys": ["access_token"] - } - } - }, - "test2": { - "path": "/api/safe/list", - "method": "GET", - "description": "get user allowed safe listing", - "expect": { - "header": { - "contains": { - "http_status": "200" - } - }, - "body": { - "hasKeys": ["safeName"], - "contains": { - "message": "success" - } - } - } - }, - "test3": { - "path": "/api/admin/safe/add", - "method": "POST", - "description": "create new safe", - "body": { - "safeName": "API test created safe" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test4": { - "path": "/api/admin/safe/add", - "method": "POST", - "description": "create new safe", - "body": { - "safeName": "API test created second safe" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test5": { - "path": "/api/admin/safe/listall", - "method": "GET", - "description": "get all defined safe listing", - "expect": { - "header": { - "contains": { - "http_status": "200" - } - }, - "body": { - "hasKeys": ["safeName"], - "contains": { - "message": "success" - } - } - } - }, - "test6": { - "path": "/api/admin/safe/delete", - "method": "POST", - "description": "get all defined safe listing", - "body": { - "safeName": "API test created safe" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - } - }, - "url": "https://10.63.39.130:8443", - "insecure": true, - "header": { - "Content-Type": "application/json", - "Authorization": "Bearer %ACCESS_TOKEN%" - }, - "capture": { - "test1": { - "body": { - "access_token": "%ACCESS_TOKEN%" - } - } - } -} - \ No newline at end of file diff --git a/test-random.json b/test-random.json deleted file mode 100644 index d43bed3..0000000 --- a/test-random.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "CBS test cases", - "testCases": { - "test1": { - "path": "/api/login", - "method": "POST", - "description": "Perform login", - "body": { - "username": "Administrator", - "password": "Password123" - }, - "expect": { - "header": { - "contains": { - "http_status": "200", - "Content-Type": "application/json" - } - }, - "body": { - "hasKeys": ["access_token"] - } - } - }, - "test12": { - "path": "/api/secret/store", - "method": "POST", - "description": "store first new secret", - "body": { - "safeId": 1, - "deviceName": { - "random": { - "isString": true, - "length": 12 - } - }, - "deviceCategory": "appliance", - "userName": "service@cdc.home", - "secretValue": { - "random": { - "isString": true, - "length": 20 - } - } - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - } - }, - "url": "https://10.63.39.130:8443", - "insecure": true, - "header": { - "Content-Type": "application/json", - "Authorization": "Bearer %ACCESS_TOKEN%" - }, - "capture": { - "test1": { - "body": { - "access_token": "%ACCESS_TOKEN%" - } - } - } -} \ No newline at end of file diff --git a/tests.json b/tests.json deleted file mode 100644 index 05482e9..0000000 --- a/tests.json +++ /dev/null @@ -1,296 +0,0 @@ -{ - "name": "CBS test cases", - "testCases": { - "test1": { - "path": "/api/login", - "method": "POST", - "description": "Perform login", - "body": { - "username": "Administrator", - "password": "Password123" - }, - "expect": { - "header": { - "contains": { - "http_status": "200", - "Content-Type": "application/json" - } - }, - "body": { - "hasKeys": ["access_token"] - } - } - }, - "test2": { - "path": "/api/admin/user/add", - "method": "POST", - "description": "register user account", - "header": { - "Authorization": "Bearer %ACCESS_TOKEN%" - }, - "body": { - "username": "test", - "password": "test" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - }, - "body": { - "contains": { - "message": "registration success" - } - } - } - }, - "test3": { - "path": "/api/admin/users", - "method": "GET", - "description": "get user account listing", - "expect": { - "body": { - "contains": { - "userName": "test" - } - } - } - }, - "test4": { - "path": "/api/admin/user/delete", - "method": "POST", - "description": "delete user account", - "body": { - "userName": "test" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - }, - "body": { - "contains": { - "message": "user deletion success" - } - } - } - }, - "test5": { - "path": "/api/admin/user/delete", - "method": "POST", - "description": "try to delete non-existing user account", - "body": { - "userName": "test" - }, - "expect": { - "header": { - "contains": { - "http_status": "400" - } - }, - "body": { - "contains": { - "error": "attempt to delete non-existing username" - } - } - } - }, - "test10": { - "path": "/api/admin/unlock", - "disabled": false, - "method": "POST", - "description": "provide unlock key", - "body": { - "secretKey": "Example32ByteSecretKey0123456789" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test11": { - "path": "/api/admin/unlock", - "disabled": false, - "method": "POST", - "description": "repeat provide unlock key", - "body": { - "secretKey": "Example32ByteSecretKey0123456789" - }, - "expect": { - "header": { - "contains": { - "http_status": "400" - } - } - } - }, - "test12": { - "path": "/api/secret/store", - "disabled": true, - "method": "POST", - "description": "store first new secret", - "body": { - "safeId": 1, - "deviceName": { - "random": { - "isString": true, - "length": 12 - } - }, - "deviceCategory": "appliance", - "userName": "service@cdc.home", - "secretValue": "TheWiggles" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test20": { - "path": "/api/secret/list", - "disabled": false, - "method": "GET", - "description": "List secrets", - "header": { - "Authorization": "Bearer %ACCESS_TOKEN%" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test21": { - "path": "/api/secret/retrieve", - "method": "POST", - "description": "get existing secret", - "body": { - "deviceName": "adcp01.cdc.home", - "deviceCategory": "windows-server", - "userName": "dummy@cdc.home" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test22": { - "path": "/api/secret/update", - "method": "POST", - "description": "update existing secret", - "body": { - "deviceName": "adcp01.cdc.home", - "deviceCategory": "windows-server", - "userName": "dummy@cdc.home", - "secretValue": "TheAlphabet29" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test23": { - "path": "/api/secret/retrieve", - "method": "POST", - "description": "get updated secret", - "body": { - "deviceName": "adcp01.cdc.home", - "deviceCategory": "windows-server", - "userName": "dummy@cdc.home" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - }, - "body": { - "contains": { - "deviceName": "adcp01.cdc.home" - } - } - } - }, - "test24": { - "path": "/api/secret/delete", - "method": "POST", - "description": "delete existing secret", - "body": { - "deviceName": "adcp01.cdc.home", - "deviceCategory": "windows-server", - "userName": "dummy@cdc.home" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test25": { - "path": "/api/secret/store", - "method": "POST", - "description": "store new secret", - "body": { - "safeId": 1, - "deviceName": "adcp01.cdc.home", - "deviceCategory": "windows-server", - "userName": "dummy@cdc.home", - "secretValue": "TheAlphabet" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test26": { - "path": "/api/secret/retrieve", - "method": "POST", - "description": "test retrieving the new secret", - "body": { - "deviceName": "adcp01.cdc.home", - "userName": "dummy@cdc.home" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - } - }, - "url": "https://10.63.39.130:8443", - "insecure": true, - "header": { - "Content-Type": "application/json", - "Authorization": "Bearer %ACCESS_TOKEN%" - }, - "capture": { - "test1": { - "body": { - "access_token": "%ACCESS_TOKEN%" - } - } - } -} \ No newline at end of file diff --git a/user-test.json b/user-test.json deleted file mode 100644 index f58e8a4..0000000 --- a/user-test.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "CBS normal user testing", - "testCases": { - "test1": { - "path": "/api/login", - "method": "POST", - "description": "Perform login", - "body": { - "username": "nathtest", - "password": "VMware1!" - }, - "expect": { - "header": { - "contains": { - "http_status": "200", - "Content-Type": "application/json" - } - }, - "body": { - "hasKeys": ["access_token"] - } - } - }, - "test20": { - "path": "/api/secret/list", - "disabled": false, - "method": "GET", - "description": "List secrets", - "header": { - "Authorization": "Bearer %ACCESS_TOKEN%" - }, - "expect": { - "header": { - "contains": { - "http_status": "200" - } - } - } - }, - "test22": { - "path": "/api/secret/update", - "method": "POST", - "description": "try update existing secret", - "body": { - "deviceName": "adcp01.cdc.home", - "deviceCategory": "windows-server", - "userName": "dummy@cdc.home", - "secretValue": "TheWiggles" - } - } - }, - "url": "https://10.63.39.130:8443", - "insecure": true, - "header": { - "Content-Type": "application/json", - "Authorization": "Bearer %ACCESS_TOKEN%" - }, - "capture": { - "test1": { - "body": { - "access_token": "%ACCESS_TOKEN%" - } - } - } -} - \ No newline at end of file