forked from ondra/colnod-connector
edit for more readability
This commit is contained in:
parent
44da045e29
commit
39205695b3
@ -4,26 +4,33 @@ TOKEN=$(curl -k --user "spaceti:E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507
|
|||||||
# Saving current time and timestamp
|
# Saving current time and timestamp
|
||||||
DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
DATE=`date +"%Y-%m-%d %H:%M:%S"`
|
||||||
TIMESTAMP=`date +%s%N | cut -b1-13`
|
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 "Current time: $DATE / timestamp: $TIMESTAMP"
|
||||||
echo "=================================="
|
echo "===================================================================="
|
||||||
echo "Creating test token with id = 235c4a3c-7e20-4f2a-8ed2-2fe36cc87907"
|
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
|
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
|
||||||
echo "Deleting test token..."
|
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
|
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
|
||||||
echo "/getTokensDeleted with time: $DATE"
|
echo "getTokensDeleted with time (before deleting): $DATE"
|
||||||
echo "Expect only one token which has been deleted"
|
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
|
curl -k -u "$TOKEN:" -d "{\"timestamp\":$TIMESTAMP}" -H "Content-Type: application/json" -X POST https://192.168.1.3:8443/TokenManager/getTokensDeleted
|
||||||
echo
|
echo
|
||||||
echo "Wait 5 secs"
|
echo "===================================================================="
|
||||||
echo "=================================="
|
echo "Waiting 5 secs, so we can ask again after deleting"
|
||||||
|
echo "===================================================================="
|
||||||
sleep 5
|
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"
|
echo "Expect no tokens returned, because token has been deleted before more than 5 secs"
|
||||||
((TIMESTAMP=TIMESTAMP+2000))
|
((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
|
curl -k -u "$TOKEN:" -d "{\"timestamp\":$TIMESTAMP}" -H "Content-Type: application/json" -X POST https://192.168.1.3:8443/TokenManager/getTokensDeleted
|
||||||
echo
|
echo
|
||||||
exit
|
exit
|
||||||
#if $EXPECTED_TOKEN is empty; then
|
|
||||||
Loading…
x
Reference in New Issue
Block a user