mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2026-01-04 03:54:53 +01:00
Improve test reliability and fix security issues
- Replace waitForTimeout with waitForSelector and waitForLoadState - Remove eval security risk in bash script - Use proper wait mechanisms for better test reliability Co-authored-by: katosdev <7927609+katosdev@users.noreply.github.com>
This commit is contained in:
36
.github/scripts/upgrade-test/create-test-data.sh
vendored
36
.github/scripts/upgrade-test/create-test-data.sh
vendored
@@ -18,21 +18,31 @@ api_call() {
|
||||
local data=$3
|
||||
local token=$4
|
||||
|
||||
local curl_cmd="curl -s -X $method"
|
||||
|
||||
if [ -n "$token" ]; then
|
||||
curl_cmd="$curl_cmd -H 'Authorization: Bearer $token'"
|
||||
if [ -n "$data" ]; then
|
||||
curl -s -X "$method" \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$data" \
|
||||
"$API_URL$endpoint"
|
||||
else
|
||||
curl -s -X "$method" \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H "Content-Type: application/json" \
|
||||
"$API_URL$endpoint"
|
||||
fi
|
||||
else
|
||||
if [ -n "$data" ]; then
|
||||
curl -s -X "$method" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$data" \
|
||||
"$API_URL$endpoint"
|
||||
else
|
||||
curl -s -X "$method" \
|
||||
-H "Content-Type: application/json" \
|
||||
"$API_URL$endpoint"
|
||||
fi
|
||||
fi
|
||||
|
||||
curl_cmd="$curl_cmd -H 'Content-Type: application/json'"
|
||||
|
||||
if [ -n "$data" ]; then
|
||||
curl_cmd="$curl_cmd -d '$data'"
|
||||
fi
|
||||
|
||||
curl_cmd="$curl_cmd $API_URL$endpoint"
|
||||
|
||||
eval $curl_cmd
|
||||
}
|
||||
|
||||
# Function to register a user and get token
|
||||
|
||||
Reference in New Issue
Block a user