mirror of
https://github.com/glimpse-app/server.git
synced 2025-04-02 10:52:45 -04:00
add 1 endpoint
This commit is contained in:
parent
185ed832d4
commit
e366c3b6e6
1 changed files with 18 additions and 5 deletions
|
@ -31,7 +31,7 @@ ENDPOINT="/api/v1/newUser"
|
|||
|
||||
printf "\n%bTest: $ENDPOINT%b\n" "$BLD" "$CLR"
|
||||
|
||||
curl -S --fail-early -X POST http://"$BINDADDR":"$PORT""$ENDPOINT" \
|
||||
curl --show-error --fail-early --request POST http://"$BINDADDR":"$PORT""$ENDPOINT" \
|
||||
-d "username=testUser" -d "password=$PASSWORD" \
|
||||
-d "email=test@example.xyz"
|
||||
|
||||
|
@ -43,9 +43,9 @@ fi; printf "%b\n" "$CLR";
|
|||
|
||||
ENDPOINT="/api/v1/newSession"
|
||||
printf "\n%bTest: $ENDPOINT%b\n" "$BLD" "$CLR"
|
||||
TOKEN=$(curl -S --fail-early -X POST http://"$BINDADDR":"$PORT""/api/v1/newUser" -d "username=testUser1" -d "password=$PASSWORD" -d "email=test@example.xyz" | jq ".[0].token" | tr -d '"')
|
||||
TOKEN=$(curl --show-error --fail-early --request POST http://"$BINDADDR":"$PORT""/api/v1/newUser" -d "username=testUser1" -d "password=$PASSWORD" -d "email=test@example.xyz" | jq ".[0].token" | tr -d '"')
|
||||
|
||||
curl -S --fail-early -X GET http://"$BINDADDR":"$PORT""$ENDPOINT" \
|
||||
curl --show-error --fail-early --request GET http://"$BINDADDR":"$PORT""$ENDPOINT" \
|
||||
-H "Authorization: $TOKEN"
|
||||
|
||||
if test $? -eq 0; then printf "%bTest: Success - $ENDPOINT" "$YAY";
|
||||
|
@ -56,9 +56,9 @@ fi; printf "%b\n" "$CLR";
|
|||
|
||||
ENDPOINT="/api/v1/newFile"
|
||||
printf "\n%bTest: $ENDPOINT%b\n" "$BLD" "$CLR"
|
||||
TOKEN=$(curl -S --fail-early -X POST http://"$BINDADDR":"$PORT""/api/v1/newUser" -d "username=testUser2" -d "password=$PASSWORD" -d "email=test@example.xyz" | jq ".[0].token" | tr -d '"')
|
||||
TOKEN=$(curl --show-error --fail-early --request POST http://"$BINDADDR":"$PORT""/api/v1/newUser" -d "username=testUser2" -d "password=$PASSWORD" -d "email=test@example.xyz" | jq ".[0].token" | tr -d '"')
|
||||
|
||||
curl -S --fail-early -X POST http://"$BINDADDR":"$PORT""$ENDPOINT" \
|
||||
curl --show-error --fail-early --request POST http://"$BINDADDR":"$PORT""$ENDPOINT" \
|
||||
-H "Authorization: $TOKEN" -F "file=@image.png"
|
||||
|
||||
if test $? -eq 0; then printf "%bTest: Success - $ENDPOINT" "$YAY";
|
||||
|
@ -66,4 +66,17 @@ else printf "%bTest: Fail - $ENDPOINT" "$NAY"; ((ERROR++));
|
|||
fi; printf "%b\n" "$CLR";
|
||||
|
||||
|
||||
|
||||
ENDPOINT="/api/v1/newFileName"
|
||||
printf "\n%bTest: $ENDPOINT%b\n" "$BLD" "$CLR"
|
||||
|
||||
curl --show-error --fail-early --request PUT http://"$BINDADDR":"$PORT""$ENDPOINT" \
|
||||
-H "Authorization: $TOKEN" -H "Old name: image.png" -H "New name: kitty.png"
|
||||
|
||||
if test $? -eq 0; then printf "%bTest: Success - $ENDPOINT" "$YAY";
|
||||
else printf "%bTest: Fail - $ENDPOINT" "$NAY"; ((ERROR++));
|
||||
fi; printf "%b\n" "$CLR";
|
||||
|
||||
|
||||
|
||||
exit $ERROR;
|
Loading…
Add table
Reference in a new issue