Files
apitester/tests.json
Nathan Coad b2519287ef
All checks were successful
continuous-integration/drone/push Build is passing
improve body contains check
2024-01-03 15:42:25 +11:00

134 lines
3.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/register",
"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"
}
}
}
},
"test10": {
"path": "/api/secret/store",
"method": "POST",
"description": "store new secret",
"body": {
"deviceName": "adcp01.cdc.home",
"deviceCategory": "windows-server",
"userName": "dummy@cdc.home",
"secretValue": "TheAlphabet"
},
"expect": {
"header": {
"contains": {
"http_status": "200"
}
}
}
},
"test99": {
"path": "/api/secret/list",
"method": "GET",
"description": "List secrets",
"header": {
"Authorization": "Bearer %ACCESS_TOKEN%"
},
"body": {
"Hostname":"host999.cdc.home",
"BootTypeUefi":true,
"parent": {
"childKey": "childValue"
}
},
"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%"
}
}
}
}