From 8e79c9df21f7dd73fcb208ca547841e8d865f772 Mon Sep 17 00:00:00 2001 From: David Griffin Date: Thu, 21 Nov 2024 15:10:24 -0800 Subject: [PATCH] Add some more requests to validate script. --- test/validate.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/validate.sh b/test/validate.sh index 79b4011..f0c2b43 100755 --- a/test/validate.sh +++ b/test/validate.sh @@ -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"