@@ -23,25 +23,39 @@ popd || exit
23
23
24
24
call_and_verify " Get List of Keys" " /v2/participation" 200 ' Address'
25
25
26
+ # Find out how many keys there are installed so far
27
+ NUM_IDS_1=$( echo " $RES " | python3 -c ' import json,sys;o=json.load(sys.stdin);print(len(o))' )
28
+
26
29
call_post_and_verify " Install a basic participation key" " /v2/participation" 200 ${NAME_OF_TEMP_PARTKEY} ' partId'
27
30
28
- call_and_verify " Get List of Keys" " /v2/participation" 200 ' Address'
31
+ # Get the returned participation id from the RESULT (aka $RES) variable
32
+ INSTALLED_ID=$( echo " $RES " | python3 -c ' import json,sys;o=json.load(sys.stdin);print(o["partId"])' )
33
+
34
+ # Should contain the installed id
35
+ call_and_verify " Get List of Keys" " /v2/participation" 200 ' Address' " ${INSTALLED_ID} "
29
36
30
- # Let's get a key from the previous response manually and request it specifically
31
- SAMPLE_ID=$( curl -q -s -H " Authorization: Bearer $ADMIN_TOKEN " " $NET /v2/participation" | python3 -c ' import json,sys;obj=json.load(sys.stdin);print(obj[0]["ID"])' )
32
- NUMBER_OF_IDS=$( curl -q -s -H " Authorization: Bearer $ADMIN_TOKEN " " $NET /v2/participation" | python3 -c ' import json,sys;obj=json.load(sys.stdin);print(len(obj))' )
37
+ # Get list of keys
38
+ NUM_IDS_2=$( echo " $RES " | python3 -c ' import json,sys;o=json.load(sys.stdin);print(len(o))' )
39
+
40
+ if [[ $(( NUM_IDS_1 + 1 )) -ne $NUM_IDS_2 ]]; then
41
+ printf " \n\nFailed test. New number of IDs (%s) is not one more than old ID count(%s)\n\n" " ${NUM_IDS_2} " " ${NUM_IDS_1} "
42
+ exit 1
43
+ fi
33
44
34
- call_and_verify " Get a specific ID" " /v2/participation/${SAMPLE_ID } " 200 " ${SAMPLE_ID } "
45
+ call_and_verify " Get a specific ID" " /v2/participation/${INSTALLED_ID } " 200 " ${INSTALLED_ID } "
35
46
36
- call_delete_and_verify " Delete the specific ID" " /v2/participation/${SAMPLE_ID} " 200
47
+ # Should return 200 but not return that error message
48
+ call_delete_and_verify " Delete the specific ID" " /v2/participation/${INSTALLED_ID} " 200 false ' participation id not found'
37
49
38
- # Verify that it got called previously and will NOT return an error now even though it isn't there
39
- call_delete_and_verify " Delete the specific ID" " /v2/participation/${SAMPLE_ID} " 200
50
+ # Verify that it got called previously and will NOT return an error now even though it isn't there.
51
+ # But it will contain a message saying that no key was found
52
+ call_delete_and_verify " Delete the specific ID" " /v2/participation/${INSTALLED_ID} " 200 true ' participation id not found'
40
53
41
- NEW_NUMBER_OF_IDS=$( curl -q -s -H " Authorization: Bearer $ADMIN_TOKEN " " $NET /v2/participation" | python3 -c ' import json,sys;obj=json.load(sys.stdin);print(len(obj))' )
54
+ # Get list of keys
55
+ NUM_IDS_3=$( echo " $RES " | python3 -c ' import json,sys;o=json.load(sys.stdin);print(len(o))' )
42
56
43
- if [[ " $NEW_NUMBER_OF_IDS " -ge " $NUMBER_OF_IDS " ]]; then
44
- printf " \n\nFailed test. New number of IDs (%s) is greater than or equal to original IDs (%s)\n\n" " ${NEW_NUMBER_OF_IDS } " " ${NUMBER_OF_IDS } "
57
+ if [[ " $NUM_IDS_3 " -ne " $NUM_IDS_1 " ]]; then
58
+ printf " \n\nFailed test. New number of IDs (%s) is not equal to original ID count (%s)\n\n" " ${NUM_IDS_3 } " " ${NUM_IDS_1 } "
45
59
exit 1
46
60
fi
47
61
0 commit comments