diff options
author | Phil <phil.buschmann@tum.de> | 2018-08-11 00:35:35 +0200 |
---|---|---|
committer | Phil <phil.buschmann@tum.de> | 2018-08-11 00:35:35 +0200 |
commit | bcda92da22a3c1824f966d4593492e8a446fd070 (patch) | |
tree | 24c6f5e2df89602111a92f6a1636da99fc41c03f /src/identity/test_plugin_rest_identity.sh | |
parent | d74e6d06434f195a7307497e4e0283185491264a (diff) | |
download | gnunet-bcda92da22a3c1824f966d4593492e8a446fd070.tar.gz gnunet-bcda92da22a3c1824f966d4593492e8a446fd070.zip |
added additional namespaces in identity rest api
Diffstat (limited to 'src/identity/test_plugin_rest_identity.sh')
-rwxr-xr-x | src/identity/test_plugin_rest_identity.sh | 99 |
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 |
59 | if [ "" == "$test" ] | 59 | if [ "" == "$test" ] |
60 | then | 60 | then |
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" |
75 | else | 75 | else |
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" |
86 | fi | 86 | fi |
87 | 87 | ||
88 | #Test POST | 88 | #Test POST |
@@ -105,55 +105,54 @@ curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1", "other":"tes | |||
105 | name="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $1}')" | 105 | name="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $1}')" |
106 | public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')" | 106 | public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')" |
107 | 107 | ||
108 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":"'$public'"}' "HTTP/1.1 204" | 108 | curl_put "${identity_link}/pubkey/$public" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 204" |
109 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":"'$public'"}' "HTTP/1.1 409" | 109 | curl_put "${identity_link}/pubkey/$public" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 409" |
110 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":"'$public'xx"}' "HTTP/1.1 404" | 110 | curl_put "${identity_link}/pubkey/${public}xx" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404" |
111 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubkey":""}' "HTTP/1.1 404" | 111 | curl_put "${identity_link}/pubkey/" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404" |
112 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubke":""}' "HTTP/1.1 404" | 112 | curl_put "${identity_link}/pubke" '{"newname":"test_plugin_rest_identity1"}' "error" |
113 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubke":"","other":"sdfdsf"}' "HTTP/1.1 404" | 113 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","other":"sdfdsf"}' "error" |
114 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","pubke":"","name":"sdfdsf"}' "HTTP/1.1 404" | 114 | curl_put "${identity_link}/pubkey/$name" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404" |
115 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity","pubke":"","name":"test_plugin_rest_identity1"}' "HTTP/1.1 204" | 115 | curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"test_plugin_rest_identity"}' "HTTP/1.1 204" |
116 | curl_put "${identity_link}" '{"newnam":"test_plugin_rest_identity","pubkey":"'$public'"}' "error" | 116 | curl_put "${identity_link}/pubkey/$public" '{"newnam":"test_plugin_rest_identity"}' "error" |
117 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","name":"test_plugin_rest_identity"}' "HTTP/1.1 204" | 117 | curl_put "${identity_link}/name/test_plugin_rest_identity" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 204" |
118 | curl_put "${identity_link}" '{"newname":"TEST_plugin_rest_identity1","name":"test_plugin_rest_identity1"}' "HTTP/1.1 409" | 118 | curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"TEST_plugin_rest_identity1"}' "HTTP/1.1 409" |
119 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity1","name":"test_plugin_rest_identity1"}' "HTTP/1.1 409" | 119 | curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 409" |
120 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity","name":"test_plugin_rest_identityxxx"}' "HTTP/1.1 404" | 120 | curl_put "${identity_link}/name/test_plugin_rest_identityxxx" '{"newname":"test_plugin_rest_identity"}' "HTTP/1.1 404" |
121 | curl_put "${identity_link}" '{"newname":"test_plugin_rest_identity","name":"test_plugin_rest_identity1"}' "HTTP/1.1 204" | 121 | curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"newname":"test_plugin_rest_identity"}' "HTTP/1.1 204" |
122 | curl_put "${identity_link}" '{"newnam":"test_plugin_rest_identityfail","name":"test_plugin_rest_identity"}' "error" | 122 | curl_put "${identity_link}/name/test_plugin_rest_identity" '{"newnam":"test_plugin_rest_identityfail"}' "error" |
123 | |||
124 | 123 | ||
125 | #Test subsystem | 124 | #Test subsystem |
126 | curl_put "${identity_link}" '{"subsystem":"namestore","name":"test_plugin_rest_identity"}' "HTTP/1.1 204" | 125 | curl_put "${identity_link}/name/test_plugin_rest_identity" '{"subsystem":"namestore"}' "HTTP/1.1 204" |
127 | curl_put "${identity_link}" '{"subsystem":"namestore","name":"test_plugin_rest_identity"}' "HTTP/1.1 204" | 126 | curl_put "${identity_link}/name/test_plugin_rest_identity" '{"subsystem":"namestore"}' "HTTP/1.1 204" |
128 | curl_get "${identity_link}?subsystem=namestore" "test_plugin_rest_identity" | 127 | curl_get "${identity_link}/subsystem/namestore" "test_plugin_rest_identity" |
129 | curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created" | 128 | curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created" |
130 | public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')" | 129 | public="$(gnunet-identity -d | grep "test_plugin_rest_identity" | awk 'NR==1{print $3}')" |
131 | curl_put "${identity_link}" '{"subsystem":"namestore","pubkey":"'"$public"'"}' "HTTP/1.1 204" | 130 | curl_put "${identity_link}/pubkey/$public" '{"subsystem":"namestore"}' "HTTP/1.1 204" |
132 | curl_get "${identity_link}?subsystem=namestore" "test_plugin_rest_identity1" | 131 | curl_get "${identity_link}/subsystem/namestore" "test_plugin_rest_identity1" |
133 | curl_get "${identity_link}?subsystem=test_plugin_rest_identity_no_subsystem" "error" | 132 | curl_get "${identity_link}/subsystem/test_plugin_rest_identity_no_subsystem" "error" |
134 | curl_put "${identity_link}" '{"subsystem":"test_plugin_rest_identity_no_subsystem","name":"test_plugin_rest_identity1"}' "HTTP/1.1 204" | 133 | curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"subsystem":"test_plugin_rest_identity_no_subsystem"}' "HTTP/1.1 204" |
135 | curl_get "${identity_link}?subsystem=test_plugin_rest_identity_no_subsystem" "test_plugin_rest_identity1" | 134 | curl_get "${identity_link}/subsystem/test_plugin_rest_identity_no_subsystem" "test_plugin_rest_identity1" |
136 | 135 | ||
137 | curl_put "${identity_link}" '{"subsyste":"test_plugin_rest_identity_no_subsystem","name":"test_plugin_rest_identity1"}' "error" | 136 | curl_put "${identity_link}/name/test_plugin_rest_identity1" '{"subsyste":"test_plugin_rest_identity_no_subsystem"}' "error" |
138 | curl_put "${identity_link}" '{"subsystem":"test_plugin_rest_identity_no_subsystem","name":"Test_plugin_rest_identity1"}' "HTTP/1.1 204" | 137 | curl_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 |
141 | curl_delete "${identity_link}?name=test_plugin_rest_identity" "HTTP/1.1 204" | 140 | curl_delete "${identity_link}/name/test_plugin_rest_identity" "HTTP/1.1 204" |
142 | curl_get "${identity_link}?name=test_plugin_rest_identity" "error" | 141 | curl_get "${identity_link}/name/test_plugin_rest_identity" "error" |
143 | curl_delete "${identity_link}?name=TEST_plugin_rest_identity1" "HTTP/1.1 404" | 142 | curl_delete "${identity_link}/name/TEST_plugin_rest_identity1" "HTTP/1.1 204" |
144 | curl_delete "${identity_link}?name=test_plugin_rest_identity1" "HTTP/1.1 204" | 143 | curl_delete "${identity_link}/name/test_plugin_rest_identity1" "HTTP/1.1 404" |
145 | curl_get "${identity_link}?name=test_plugin_rest_identity1" "error" | 144 | curl_get "${identity_link}/name/test_plugin_rest_identity1" "error" |
146 | curl_delete "${identity_link}?name=test_plugin_rest_identity_not_found" "HTTP/1.1 404" | 145 | curl_delete "${identity_link}/name/test_plugin_rest_identity_not_found" "HTTP/1.1 404" |
147 | curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created" | 146 | curl_post "${identity_link}" '{"name":"test_plugin_rest_identity1"}' "HTTP/1.1 201 Created" |
148 | public="$(gnunet-identity -d | grep "test_plugin_rest_identity1" | awk 'NR==1{print $3}')" | 147 | public="$(gnunet-identity -d | grep "test_plugin_rest_identity1" | awk 'NR==1{print $3}')" |
149 | curl_delete "${identity_link}?pubkey=$public" "HTTP/1.1 204" | 148 | curl_delete "${identity_link}/pubkey/$public" "HTTP/1.1 204" |
150 | curl_delete "${identity_link}?pubke=$public" "error" | 149 | curl_delete "${identity_link}/pubke/$public" "error" |
151 | curl_delete "${identity_link}?pubkey=$public&other=232" "HTTP/1.1 404" | 150 | curl_delete "${identity_link}/pubkey/${public}other=232" "HTTP/1.1 404" |
152 | 151 | ||
153 | #Test wrong_link | 152 | #Test wrong_link |
154 | curl_get "$wrong_link" "HTTP/1.1 404" | 153 | curl_get "$wrong_link" "HTTP/1.1 404" |
155 | curl_post "$wrong_link" '{"name":"test_plugin_rest_identity"}' "HTTP/1.1 404" | 154 | curl_post "$wrong_link" '{"name":"test_plugin_rest_identity"}' "HTTP/1.1 404" |
156 | curl_put "$wrong_link" '{"newname":"test_plugin_rest_identity1","name":"test_plugin_rest_identity"}' "HTTP/1.1 404" | 155 | curl_put "$wrong_link/name/test_plugin_rest_identity" '{"newname":"test_plugin_rest_identity1"}' "HTTP/1.1 404" |
157 | curl_delete "$wrong_link?name=test_plugin_rest_identity1" "HTTP/1.1 404" | 156 | curl_delete "$wrong_link/name/test_plugin_rest_identity1" "HTTP/1.1 404" |
158 | 157 | ||
159 | exit 0; | 158 | exit 0; |