diff options
Diffstat (limited to 'src/gns/test_plugin_rest_gns.sh')
-rwxr-xr-x | src/gns/test_plugin_rest_gns.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/gns/test_plugin_rest_gns.sh b/src/gns/test_plugin_rest_gns.sh new file mode 100755 index 000000000..7ede44501 --- /dev/null +++ b/src/gns/test_plugin_rest_gns.sh | |||
@@ -0,0 +1,50 @@ | |||
1 | #!/usr/bin/bash | ||
2 | |||
3 | #First, start gnunet-arm and the rest-service. | ||
4 | #Exit 0 means success, exit 1 means failed test | ||
5 | |||
6 | gns_link="http://localhost:7776/gns" | ||
7 | wrong_link="http://localhost:7776/gnsandmore" | ||
8 | |||
9 | curl_get () { | ||
10 | #$1 is link | ||
11 | #$2 is grep | ||
12 | cache="$(curl -v "$1" 2>&1 | grep "$2")" | ||
13 | #echo $cache | ||
14 | if [ "" == "$cache" ] | ||
15 | then | ||
16 | exit 1 | ||
17 | fi | ||
18 | } | ||
19 | |||
20 | gnunet-identity -D "test_plugin_rest_gns" > /dev/null 2>&1 | ||
21 | |||
22 | curl_get "$gns_link?name=www.test_plugin_rest_gns" "error" | ||
23 | |||
24 | gnunet-identity -C "test_plugin_rest_gns" | ||
25 | |||
26 | curl_get "$gns_link?name=www.test_plugin_rest_gns" "\[\]" | ||
27 | |||
28 | gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1.1.1.1 -t A | ||
29 | |||
30 | curl_get "$gns_link?name=www.test_plugin_rest_gns" "1.1.1.1" | ||
31 | |||
32 | gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1::1 -t AAAA | ||
33 | |||
34 | curl_get "$gns_link?name=www.test_plugin_rest_gns" "1::1.*1.1.1.1" | ||
35 | |||
36 | gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1.1.1.2 -t A | ||
37 | |||
38 | curl_get "$gns_link?name=www.test_plugin_rest_gns" "1.1.1.2.*1::1.*1.1.1.1" | ||
39 | curl_get "$gns_link?name=www.test_plugin_rest_gns&record_type=A" "1.1.1.2.*1.1.1.1" | ||
40 | curl_get "$gns_link?name=www.test_plugin_rest_gns&record_type=AAAA" "1::1" | ||
41 | curl_get "$gns_link?name=www.test_plugin_rest_gns&record_type=WRONG_TYPE" "1.1.1.2.*1::1.*1.1.1.1" | ||
42 | |||
43 | gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www1 -e 1d -V 1.1.1.1 -t A | ||
44 | curl_get "$gns_link?name=www1.test_plugin_rest_gns" "1.1.1.1" | ||
45 | |||
46 | gnunet-identity -D "test_plugin_rest_gns" | ||
47 | |||
48 | curl_get "$gns_link?name=www1.test_plugin_rest_gns" "error" | ||
49 | |||
50 | exit 0 | ||