summaryrefslogtreecommitdiff
path: root/src/identity/test_plugin_rest_identity.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/identity/test_plugin_rest_identity.sh')
-rwxr-xr-xsrc/identity/test_plugin_rest_identity.sh99
1 files changed, 49 insertions, 50 deletions
diff --git a/src/identity/test_plugin_rest_identity.sh b/src/identity/test_plugin_rest_identity.sh
index d9377500e..3eac0950c 100755
--- a/src/identity/test_plugin_rest_identity.sh
+++ b/src/identity/test_plugin_rest_identity.sh
@@ -58,31 +58,31 @@ test="$(gnunet-identity -d)"
#if no identity exists
if [ "" == "$test" ]
then
- curl_get "$identity_link" "error"
+ curl_get "$identity_link/all" "error"
gnunet-identity -C "test_plugin_rest_identity"
name="$(gnunet-identity -d | awk 'NR==1{print $1}')"
public="$(gnunet-identity -d | awk 'NR==1{print $3}')"
- curl_get "${identity_link}?name=$name" "$public"
- curl_get "${identity_link}?name=" "error"
- curl_get "${identity_link}?name=$public" "error"
+ curl_get "${identity_link}/name/$name" "$public"
+ curl_get "${identity_link}/name/$public" "error"
+ curl_get "${identity_link}/name/" "error"
- curl_get "${identity_link}?pubkey=$public" "$name"
- curl_get "${identity_link}?pubkey=$name" "error"
- curl_get "${identity_link}?pubkey=" "error"
+ curl_get "${identity_link}/pubkey/$public" "$name"
+ curl_get "${identity_link}/pubkey/$name" "error"
+ curl_get "${identity_link}/pubkey/" "error"
gnunet-identity -D "test_plugin_rest_identity"
else
name="$(gnunet-identity -d | awk 'NR==1{print $1}')"
public="$(gnunet-identity -d | awk 'NR==1{print $3}')"
- curl_get "${identity_link}?name=$name" "$public"
- curl_get "${identity_link}?name=" "error"
- curl_get "${identity_link}?name=$public" "error"
+ curl_get "${identity_link}/name/$name" "$public"
+ curl_get "${identity_link}/name/$public" "error"
+ curl_get "${identity_link}/name/" "error"
- curl_get "${identity_link}?pubkey=$public" "$name"
- curl_get "${identity_link}?pubkey=$name" "error"
- curl_get "${identity_link}?pubkey=" "error"
+ curl_get "${identity_link}/pubkey/$public" "$name"
+ curl_get "${identity_link}/pubkey/$name" "error"
+ curl_get "${identity_link}/pubkey/" "error"
fi
#Test POST
@@ -105,55 +105,54 @@ curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1", "other":"tes
name="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $1}')"
public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":"'$public'"}' "HTTP/1.1 204"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":"'$public'"}' "HTTP/1.1 409"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":"'$public'xx"}' "HTTP/1.1 404"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":""}' "HTTP/1.1 404"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubke":""}' "HTTP/1.1 404"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubke":"","other":"sdfdsf"}' "HTTP/1.1 404"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubke":"","name":"sdfdsf"}' "HTTP/1.1 404"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity","pubke":"","name":"test_plugin_rest_identity1"}' "HTTP/1.1 204"
-curl_put "${identity_link}" '{"newnam":"test_plugin_rest_identity","pubkey":"'$public'"}' "error"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","name":"test_plugin_rest_identity"}' "HTTP/1.1 204"
-curl_put "${identity_link}" '{"newname":"TEST_plugin_rest_identity1","name":"test_plugin_rest_identity1"}' "HTTP/1.1 409"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","name":"test_plugin_rest_identity1"}' "HTTP/1.1 409"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity","name":"test_plugin_rest_identityxxx"}' "HTTP/1.1 404"
-curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity","name":"test_plugin_rest_identity1"}' "HTTP/1.1 204"
-curl_put "${identity_link}" '{"newnam":"test_plugin_rest_identityfail","name":"test_plugin_rest_identity"}' "error"
-
+curl_put "${identity_link}/pubkey/$public" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 204"
+curl_put "${identity_link}/pubkey/$public" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 409"
+curl_put "${identity_link}/pubkey/${public}xx" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404"
+curl_put "${identity_link}/pubkey/" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404"
+curl_put "${identity_link}/pubke" '{"newname":"test_plugin_rest_identity1"}' "error"
+curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","other":"sdfdsf"}' "error"
+curl_put "${identity_link}/pubkey/$name" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404"
+curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"test_plugin_rest_identity"}' "HTTP/1.1 204"
+curl_put "${identity_link}/pubkey/$public" '{"newnam":"test_plugin_rest_identity"}' "error"
+curl_put "${identity_link}/name/test_plugin_rest_identity" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 204"
+curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"TEST_plugin_rest_identity1"}' "HTTP/1.1 409"
+curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 409"
+curl_put "${identity_link}/name/test_plugin_rest_identityxxx" '{"newname":"test_plugin_rest_identity"}' "HTTP/1.1 404"
+curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"test_plugin_rest_identity"}' "HTTP/1.1 204"
+curl_put "${identity_link}/name/test_plugin_rest_identity" '{"newnam":"test_plugin_rest_identityfail"}' "error"
#Test subsystem
-curl_put "${identity_link}" '{"subsystem":"namestore","name":"test_plugin_rest_identity"}' "HTTP/1.1 204"
-curl_put "${identity_link}" '{"subsystem":"namestore","name":"test_plugin_rest_identity"}' "HTTP/1.1 204"
-curl_get "${identity_link}?subsystem=namestore" "test_plugin_rest_identity"
+curl_put "${identity_link}/name/test_plugin_rest_identity" '{"subsystem":"namestore"}' "HTTP/1.1 204"
+curl_put "${identity_link}/name/test_plugin_rest_identity" '{"subsystem":"namestore"}' "HTTP/1.1 204"
+curl_get "${identity_link}/subsystem/namestore" "test_plugin_rest_identity"
curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created"
public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')"
-curl_put "${identity_link}" '{"subsystem":"namestore","pubkey":"'"$public"'"}' "HTTP/1.1 204"
-curl_get "${identity_link}?subsystem=namestore" "test_plugin_rest_identity1"
-curl_get "${identity_link}?subsystem=test_plugin_rest_identity_no_subsystem" "error"
-curl_put "${identity_link}" '{"subsystem":"test_plugin_rest_identity_no_subsystem","name":"test_plugin_rest_identity1"}' "HTTP/1.1 204"
-curl_get "${identity_link}?subsystem=test_plugin_rest_identity_no_subsystem" "test_plugin_rest_identity1"
+curl_put "${identity_link}/pubkey/$public" '{"subsystem":"namestore"}' "HTTP/1.1 204"
+curl_get "${identity_link}/subsystem/namestore" "test_plugin_rest_identity1"
+curl_get "${identity_link}/subsystem/test_plugin_rest_identity_no_subsystem" "error"
+curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"subsystem":"test_plugin_rest_identity_no_subsystem"}' "HTTP/1.1 204"
+curl_get "${identity_link}/subsystem/test_plugin_rest_identity_no_subsystem" "test_plugin_rest_identity1"
-curl_put "${identity_link}" '{"subsyste":"test_plugin_rest_identity_no_subsystem","name":"test_plugin_rest_identity1"}' "error"
-curl_put "${identity_link}" '{"subsystem":"test_plugin_rest_identity_no_subsystem","name":"Test_plugin_rest_identity1"}' "HTTP/1.1 204"
+curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"subsyste":"test_plugin_rest_identity_no_subsystem"}' "error"
+curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"subsystem":"test_plugin_rest_identity_no_subsystem"}' "HTTP/1.1 204"
#Test DELETE
-curl_delete "${identity_link}?name=test_plugin_rest_identity" "HTTP/1.1 204"
-curl_get "${identity_link}?name=test_plugin_rest_identity" "error"
-curl_delete "${identity_link}?name=TEST_plugin_rest_identity1" "HTTP/1.1 404"
-curl_delete "${identity_link}?name=test_plugin_rest_identity1" "HTTP/1.1 204"
-curl_get "${identity_link}?name=test_plugin_rest_identity1" "error"
-curl_delete "${identity_link}?name=test_plugin_rest_identity_not_found" "HTTP/1.1 404"
+curl_delete "${identity_link}/name/test_plugin_rest_identity" "HTTP/1.1 204"
+curl_get "${identity_link}/name/test_plugin_rest_identity" "error"
+curl_delete "${identity_link}/name/TEST_plugin_rest_identity1" "HTTP/1.1 204"
+curl_delete "${identity_link}/name/test_plugin_rest_identity1" "HTTP/1.1 404"
+curl_get "${identity_link}/name/test_plugin_rest_identity1" "error"
+curl_delete "${identity_link}/name/test_plugin_rest_identity_not_found" "HTTP/1.1 404"
curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created"
public="$(gnunet-identity -d | grep "test_plugin_rest_identity1" | awk 'NR==1{print $3}')"
-curl_delete "${identity_link}?pubkey=$public" "HTTP/1.1 204"
-curl_delete "${identity_link}?pubke=$public" "error"
-curl_delete "${identity_link}?pubkey=$public&other=232" "HTTP/1.1 404"
+curl_delete "${identity_link}/pubkey/$public" "HTTP/1.1 204"
+curl_delete "${identity_link}/pubke/$public" "error"
+curl_delete "${identity_link}/pubkey/${public}other=232" "HTTP/1.1 404"
#Test wrong_link
curl_get "$wrong_link" "HTTP/1.1 404"
curl_post "$wrong_link" '{"name":"test_plugin_rest_identity"}' "HTTP/1.1 404"
-curl_put "$wrong_link" '{"newname":"test_plugin_rest_identity1","name":"test_plugin_rest_identity"}' "HTTP/1.1 404"
-curl_delete "$wrong_link?name=test_plugin_rest_identity1" "HTTP/1.1 404"
+curl_put "$wrong_link/name/test_plugin_rest_identity" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404"
+curl_delete "$wrong_link/name/test_plugin_rest_identity1" "HTTP/1.1 404"
exit 0;