aboutsummaryrefslogtreecommitdiff
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)"
58#if no identity exists 58#if no identity exists
59if [ "" == "$test" ] 59if [ "" == "$test" ]
60then 60then
61 curl_get "$identity_link" "error" 61 curl_get "$identity_link/all" "error"
62 gnunet-identity -C "test_plugin_rest_identity" 62 gnunet-identity -C "test_plugin_rest_identity"
63 name="$(gnunet-identity -d | awk 'NR==1{print $1}')" 63 name="$(gnunet-identity -d | awk 'NR==1{print $1}')"
64 public="$(gnunet-identity -d | awk 'NR==1{print $3}')" 64 public="$(gnunet-identity -d | awk 'NR==1{print $3}')"
65 65
66 curl_get "${identity_link}?name=$name" "$public" 66 curl_get "${identity_link}/name/$name" "$public"
67 curl_get "${identity_link}?name=" "error" 67 curl_get "${identity_link}/name/$public" "error"
68 curl_get "${identity_link}?name=$public" "error" 68 curl_get "${identity_link}/name/" "error"
69 69
70 curl_get "${identity_link}?pubkey=$public" "$name" 70 curl_get "${identity_link}/pubkey/$public" "$name"
71 curl_get "${identity_link}?pubkey=$name" "error" 71 curl_get "${identity_link}/pubkey/$name" "error"
72 curl_get "${identity_link}?pubkey=" "error" 72 curl_get "${identity_link}/pubkey/" "error"
73 73
74 gnunet-identity -D "test_plugin_rest_identity" 74 gnunet-identity -D "test_plugin_rest_identity"
75else 75else
76 name="$(gnunet-identity -d | awk 'NR==1{print $1}')" 76 name="$(gnunet-identity -d | awk 'NR==1{print $1}')"
77 public="$(gnunet-identity -d | awk 'NR==1{print $3}')" 77 public="$(gnunet-identity -d | awk 'NR==1{print $3}')"
78 78
79 curl_get "${identity_link}?name=$name" "$public" 79 curl_get "${identity_link}/name/$name" "$public"
80 curl_get "${identity_link}?name=" "error" 80 curl_get "${identity_link}/name/$public" "error"
81 curl_get "${identity_link}?name=$public" "error" 81 curl_get "${identity_link}/name/" "error"
82 82
83 curl_get "${identity_link}?pubkey=$public" "$name" 83 curl_get "${identity_link}/pubkey/$public" "$name"
84 curl_get "${identity_link}?pubkey=$name" "error" 84 curl_get "${identity_link}/pubkey/$name" "error"
85 curl_get "${identity_link}?pubkey=" "error" 85 curl_get "${identity_link}/pubkey/" "error"
86fi 86fi
87 87
88#Test POST 88#Test POST
@@ -105,55 +105,54 @@ curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1", "other":"tes
105name="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $1}')" 105name="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $1}')"
106public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')" 106public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')"
107 107
108curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":"'$public'"}' "HTTP/1.1 204" 108curl_put "${identity_link}/pubkey/$public" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 204"
109curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":"'$public'"}' "HTTP/1.1 409" 109curl_put "${identity_link}/pubkey/$public" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 409"
110curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":"'$public'xx"}' "HTTP/1.1 404" 110curl_put "${identity_link}/pubkey/${public}xx" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404"
111curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":""}' "HTTP/1.1 404" 111curl_put "${identity_link}/pubkey/" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404"
112curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubke":""}' "HTTP/1.1 404" 112curl_put "${identity_link}/pubke" '{"newname":"test_plugin_rest_identity1"}' "error"
113curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubke":"","other":"sdfdsf"}' "HTTP/1.1 404" 113curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","other":"sdfdsf"}' "error"
114curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubke":"","name":"sdfdsf"}' "HTTP/1.1 404" 114curl_put "${identity_link}/pubkey/$name" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404"
115curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity","pubke":"","name":"test_plugin_rest_identity1"}' "HTTP/1.1 204" 115curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"test_plugin_rest_identity"}' "HTTP/1.1 204"
116curl_put "${identity_link}" '{"newnam":"test_plugin_rest_identity","pubkey":"'$public'"}' "error" 116curl_put "${identity_link}/pubkey/$public" '{"newnam":"test_plugin_rest_identity"}' "error"
117curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","name":"test_plugin_rest_identity"}' "HTTP/1.1 204" 117curl_put "${identity_link}/name/test_plugin_rest_identity" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 204"
118curl_put "${identity_link}" '{"newname":"TEST_plugin_rest_identity1","name":"test_plugin_rest_identity1"}' "HTTP/1.1 409" 118curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"TEST_plugin_rest_identity1"}' "HTTP/1.1 409"
119curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","name":"test_plugin_rest_identity1"}' "HTTP/1.1 409" 119curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 409"
120curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity","name":"test_plugin_rest_identityxxx"}' "HTTP/1.1 404" 120curl_put "${identity_link}/name/test_plugin_rest_identityxxx" '{"newname":"test_plugin_rest_identity"}' "HTTP/1.1 404"
121curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity","name":"test_plugin_rest_identity1"}' "HTTP/1.1 204" 121curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"test_plugin_rest_identity"}' "HTTP/1.1 204"
122curl_put "${identity_link}" '{"newnam":"test_plugin_rest_identityfail","name":"test_plugin_rest_identity"}' "error" 122curl_put "${identity_link}/name/test_plugin_rest_identity" '{"newnam":"test_plugin_rest_identityfail"}' "error"
123
124 123
125#Test subsystem 124#Test subsystem
126curl_put "${identity_link}" '{"subsystem":"namestore","name":"test_plugin_rest_identity"}' "HTTP/1.1 204" 125curl_put "${identity_link}/name/test_plugin_rest_identity" '{"subsystem":"namestore"}' "HTTP/1.1 204"
127curl_put "${identity_link}" '{"subsystem":"namestore","name":"test_plugin_rest_identity"}' "HTTP/1.1 204" 126curl_put "${identity_link}/name/test_plugin_rest_identity" '{"subsystem":"namestore"}' "HTTP/1.1 204"
128curl_get "${identity_link}?subsystem=namestore" "test_plugin_rest_identity" 127curl_get "${identity_link}/subsystem/namestore" "test_plugin_rest_identity"
129curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created" 128curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created"
130public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')" 129public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')"
131curl_put "${identity_link}" '{"subsystem":"namestore","pubkey":"'"$public"'"}' "HTTP/1.1 204" 130curl_put "${identity_link}/pubkey/$public" '{"subsystem":"namestore"}' "HTTP/1.1 204"
132curl_get "${identity_link}?subsystem=namestore" "test_plugin_rest_identity1" 131curl_get "${identity_link}/subsystem/namestore" "test_plugin_rest_identity1"
133curl_get "${identity_link}?subsystem=test_plugin_rest_identity_no_subsystem" "error" 132curl_get "${identity_link}/subsystem/test_plugin_rest_identity_no_subsystem" "error"
134curl_put "${identity_link}" '{"subsystem":"test_plugin_rest_identity_no_subsystem","name":"test_plugin_rest_identity1"}' "HTTP/1.1 204" 133curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"subsystem":"test_plugin_rest_identity_no_subsystem"}' "HTTP/1.1 204"
135curl_get "${identity_link}?subsystem=test_plugin_rest_identity_no_subsystem" "test_plugin_rest_identity1" 134curl_get "${identity_link}/subsystem/test_plugin_rest_identity_no_subsystem" "test_plugin_rest_identity1"
136 135
137curl_put "${identity_link}" '{"subsyste":"test_plugin_rest_identity_no_subsystem","name":"test_plugin_rest_identity1"}' "error" 136curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"subsyste":"test_plugin_rest_identity_no_subsystem"}' "error"
138curl_put "${identity_link}" '{"subsystem":"test_plugin_rest_identity_no_subsystem","name":"Test_plugin_rest_identity1"}' "HTTP/1.1 204" 137curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"subsystem":"test_plugin_rest_identity_no_subsystem"}' "HTTP/1.1 204"
139 138
140#Test DELETE 139#Test DELETE
141curl_delete "${identity_link}?name=test_plugin_rest_identity" "HTTP/1.1 204" 140curl_delete "${identity_link}/name/test_plugin_rest_identity" "HTTP/1.1 204"
142curl_get "${identity_link}?name=test_plugin_rest_identity" "error" 141curl_get "${identity_link}/name/test_plugin_rest_identity" "error"
143curl_delete "${identity_link}?name=TEST_plugin_rest_identity1" "HTTP/1.1 404" 142curl_delete "${identity_link}/name/TEST_plugin_rest_identity1" "HTTP/1.1 204"
144curl_delete "${identity_link}?name=test_plugin_rest_identity1" "HTTP/1.1 204" 143curl_delete "${identity_link}/name/test_plugin_rest_identity1" "HTTP/1.1 404"
145curl_get "${identity_link}?name=test_plugin_rest_identity1" "error" 144curl_get "${identity_link}/name/test_plugin_rest_identity1" "error"
146curl_delete "${identity_link}?name=test_plugin_rest_identity_not_found" "HTTP/1.1 404" 145curl_delete "${identity_link}/name/test_plugin_rest_identity_not_found" "HTTP/1.1 404"
147curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created" 146curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created"
148public="$(gnunet-identity -d | grep "test_plugin_rest_identity1" | awk 'NR==1{print $3}')" 147public="$(gnunet-identity -d | grep "test_plugin_rest_identity1" | awk 'NR==1{print $3}')"
149curl_delete "${identity_link}?pubkey=$public" "HTTP/1.1 204" 148curl_delete "${identity_link}/pubkey/$public" "HTTP/1.1 204"
150curl_delete "${identity_link}?pubke=$public" "error" 149curl_delete "${identity_link}/pubke/$public" "error"
151curl_delete "${identity_link}?pubkey=$public&other=232" "HTTP/1.1 404" 150curl_delete "${identity_link}/pubkey/${public}other=232" "HTTP/1.1 404"
152 151
153#Test wrong_link 152#Test wrong_link
154curl_get "$wrong_link" "HTTP/1.1 404" 153curl_get "$wrong_link" "HTTP/1.1 404"
155curl_post "$wrong_link" '{"name":"test_plugin_rest_identity"}' "HTTP/1.1 404" 154curl_post "$wrong_link" '{"name":"test_plugin_rest_identity"}' "HTTP/1.1 404"
156curl_put "$wrong_link" '{"newname":"test_plugin_rest_identity1","name":"test_plugin_rest_identity"}' "HTTP/1.1 404" 155curl_put "$wrong_link/name/test_plugin_rest_identity" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404"
157curl_delete "$wrong_link?name=test_plugin_rest_identity1" "HTTP/1.1 404" 156curl_delete "$wrong_link/name/test_plugin_rest_identity1" "HTTP/1.1 404"
158 157
159exit 0; 158exit 0;