added field change and get and updated tests
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 10s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 15s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 12s

This commit is contained in:
wt committed 2025-08-30 12:08:57 +07:00
1 parent 27ba0ab45e
commit 56d670c9b6
10 files changed
+225 -69

No files matched your search

+68
View File
@@ -436,6 +436,40 @@ else
errors=$(($errors+1))
fi
# test POST /api/users/password without post data
printf "==> ${BLUE}Testing${CYAN} POST${BWHITE} /api/users/password without post data${RESET} "
curl \
--silent \
-X POST \
-d "" \
localhost:8222/api/users/password &> api_users_password_no_data_test.log
sleep 0.1
res=$(cat api_users_password_no_data_test.log)
if [[ "$res" == *'{"error":"must have token, old_password, new_password"}'* ]]; then
printf "[$GREEN OK $RESET]\n"
success=$(($success+1))
else
printf "[$RED ERR $RESET]\n==> ${BLUE}Response: $RESET$(echo $res)\n"
errors=$(($errors+1))
fi
# test POST /api/users/password with wrong json
printf "==> ${BLUE}Testing${CYAN} POST${BWHITE} /api/users/password with wrong json${RESET} "
curl \
--silent \
-X POST \
-d "ijansd fu9q303ghq9" \
localhost:8222/api/users/password &> api_users_password_wrong_json_test.log
sleep 0.1
res=$(cat api_users_password_wrong_json_test.log)
if [[ "$res" == *'error'* ]]; then
printf "[$GREEN OK $RESET]\n"
success=$(($success+1))
else
printf "[$RED ERR $RESET]\n==> ${BLUE}Response: $RESET$(echo $res)\n"
errors=$(($errors+1))
fi
# test PUT /api/users
printf "==> ${BLUE}Testing${YELLOW} PUT${BWHITE} /api/users${RESET} "
reqtoken=$(cat api_token_test.log | sed -e "s/{//g" | sed -e "s/}//g")
@@ -459,6 +493,40 @@ else
errors=$(($errors+1))
fi
# test PUT /api/users without post data
printf "==> ${BLUE}Testing${YELLOW} PUT${BWHITE} /api/users without post data${RESET} "
curl \
--silent \
-X PUT \
-d "" \
localhost:8222/api/users &> put_api_users_no_data_test.log
sleep 0.1
res=$(cat put_api_users_no_data_test.log)
if [[ "$res" == *'{"error":"must have token, new_user_data"}'* ]]; then
printf "[$GREEN OK $RESET]\n"
success=$(($success+1))
else
printf "[$RED ERR $RESET]\n==> ${BLUE}Response: $RESET$(echo $res)\n"
errors=$(($errors+1))
fi
# test PUT /api/users with wrong json
printf "==> ${BLUE}Testing${YELLOW} PUT${BWHITE} /api/users with wrong json${RESET} "
curl \
--silent \
-X PUT \
-d "hiusdf 7qyt0 y qy40" \
localhost:8222/api/users &> put_api_users_wrong_json_test.log
sleep 0.1
res=$(cat put_api_users_wrong_json_test.log)
if [[ "$res" == *'error'* ]]; then
printf "[$GREEN OK $RESET]\n"
success=$(($success+1))
else
printf "[$RED ERR $RESET]\n==> ${BLUE}Response: $RESET$(echo $res)\n"
errors=$(($errors+1))
fi
# test POST /api/register
printf "==> ${BLUE}Testing${CYAN} POST${BWHITE} /api/register${RESET} "
curl \