From 39205695b34253234e77e1380c7edc16c003f81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Fischer?= Date: Tue, 5 Nov 2019 11:48:12 +0100 Subject: [PATCH] edit for more readability --- bugs/getTokensDeleted.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/bugs/getTokensDeleted.sh b/bugs/getTokensDeleted.sh index 57d464b..6d762b7 100644 --- a/bugs/getTokensDeleted.sh +++ b/bugs/getTokensDeleted.sh @@ -4,26 +4,33 @@ TOKEN=$(curl -k --user "spaceti:E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507 # Saving current time and timestamp DATE=`date +"%Y-%m-%d %H:%M:%S"` TIMESTAMP=`date +%s%N | cut -b1-13` -echo "==================================" +echo +echo "I'm going to add and delete test token," +echo "then ask for deleted tokens with time before deleting" +echo "and with time after deleting." +echo "It should return token deleted with time before," +echo "but should NOT with time after." +echo "====================================================================" echo "Current time: $DATE / timestamp: $TIMESTAMP" -echo "==================================" +echo "====================================================================" echo "Creating test token with id = 235c4a3c-7e20-4f2a-8ed2-2fe36cc87907" curl -k -u "$TOKEN:" -d '{"items":[{"id":"235c4a3c-7e20-4f2a-8ed2-2fe36cc87907","name":"bug test","description":"mobile","tokenType":"Token","tokenBits":32,"tokenData":"7B9D32","timeToLive":255,"authErrors":255,"flags":["Enabled","NoValidity"],"subjectId":"72b37f7e-5761-4e6c-8e87-20c0bed0d904"}]}' -H "Content-Type: application/json" -X POST https://192.168.1.3:8443/TokenManager/setTokens echo echo "Deleting test token..." curl -k -u "$TOKEN:" -d '{"items":["235c4a3c-7e20-4f2a-8ed2-2fe36cc87907"]}' -H "Content-Type: application/json" -X POST https://192.168.1.3:8443/TokenManager/deleteTokens +echo echo -echo "/getTokensDeleted with time: $DATE" +echo "getTokensDeleted with time (before deleting): $DATE" echo "Expect only one token which has been deleted" curl -k -u "$TOKEN:" -d "{\"timestamp\":$TIMESTAMP}" -H "Content-Type: application/json" -X POST https://192.168.1.3:8443/TokenManager/getTokensDeleted echo -echo "Wait 5 secs" -echo "==================================" +echo "====================================================================" +echo "Waiting 5 secs, so we can ask again after deleting" +echo "====================================================================" sleep 5 -echo "/getTokensDeleted with time: $DATE + 2 sec" +echo "getTokensDeleted with time (after deleting): $DATE + 2 sec" echo "Expect no tokens returned, because token has been deleted before more than 5 secs" ((TIMESTAMP=TIMESTAMP+2000)) curl -k -u "$TOKEN:" -d "{\"timestamp\":$TIMESTAMP}" -H "Content-Type: application/json" -X POST https://192.168.1.3:8443/TokenManager/getTokensDeleted echo -exit -#if $EXPECTED_TOKEN is empty; then \ No newline at end of file +exit \ No newline at end of file