Files
apitester/tests.json
Nathan Coad 2afdacaa78
All checks were successful
continuous-integration/drone/push Build is passing
implement feature to generate random test data
2024-01-11 16:14:00 +11:00

296 lines
8.7 KiB
JSON

{
"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%"
}
}
}
}