Skip to content

Commit

Permalink
Add some more requests to validate script.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Griffin committed Nov 21, 2024
1 parent 7321529 commit 8e79c9d
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions test/validate.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
#! /bin/sh

ENDPOINT="http://localhost:8080"
ACCEPT="Accept: application/json"
CONTENT="Content-Type: application/json"

curl -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer secret" \
curl --silent -H "$ACCEPT" -H "$CONTENT" --retry-all-errors \
--connect-timeout 5 --max-time 10 --retry 5 --retry-delay 10 --retry-max-time 60 \
--retry-all-errors "$ENDPOINT/products?pageSize=1"
"$ENDPOINT/products?pageSize=1" > page_one.json
cat one.json

AFTER=`jq '.after | .token' page_one.json | xargs`

curl --silent -H "$ACCEPT" -H "$CONTENT" --silent \
"$ENDPOINT/products?pageSize=1&afterToken=$AFTER" > page_two.json

jq '.data | .[] | .name' page_two.json

curl --silent -H "$ACCEPT" -H "$CONTENT" "$ENDPOINT/products/search?minPrice=1000&maxPrice=10000" > search.json

jq '.data | .[] | .name' search.json

NEW_PRODUCT="{ \"name\": \"Coolest toy\", \"description\": \"All the cool kids have one.\",
\"category\": \"electronics\", \"price\": 9999, \"stock\": 99 }"

# curl --silent -H "$ACCEPT" -H "$CONTENT" -X POST "$ENDPOINT/products" -d "$NEW_PRODUCT"

0 comments on commit 8e79c9d

Please sign in to comment.