aboutsummaryrefslogtreecommitdiff
path: root/src/gns/test_plugin_rest_gns.sh
diff options
context:
space:
mode:
authorSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-08-09 23:57:14 +0200
committerSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-08-09 23:57:14 +0200
commit08c410658159c0975ad87d7b7582259cd2ac6ee4 (patch)
treef567c9020be2505f1c16a7249020e3e965ba7194 /src/gns/test_plugin_rest_gns.sh
parent389f4939845a0cb00e5ce0d8ea3ab7fc0541fd1c (diff)
parent1ad7b69834fffc95e05354983009e435030c0861 (diff)
downloadgnunet-08c410658159c0975ad87d7b7582259cd2ac6ee4.tar.gz
gnunet-08c410658159c0975ad87d7b7582259cd2ac6ee4.zip
Merge branch 'gsoc2018/rest_api'
Diffstat (limited to 'src/gns/test_plugin_rest_gns.sh')
-rwxr-xr-xsrc/gns/test_plugin_rest_gns.sh50
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
6gns_link="http://localhost:7776/gns"
7wrong_link="http://localhost:7776/gnsandmore"
8
9curl_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
20gnunet-identity -D "test_plugin_rest_gns" > /dev/null 2>&1
21
22curl_get "$gns_link?name=www.test_plugin_rest_gns" "error"
23
24gnunet-identity -C "test_plugin_rest_gns"
25
26curl_get "$gns_link?name=www.test_plugin_rest_gns" "\[\]"
27
28gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1.1.1.1 -t A
29
30curl_get "$gns_link?name=www.test_plugin_rest_gns" "1.1.1.1"
31
32gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1::1 -t AAAA
33
34curl_get "$gns_link?name=www.test_plugin_rest_gns" "1::1.*1.1.1.1"
35
36gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1.1.1.2 -t A
37
38curl_get "$gns_link?name=www.test_plugin_rest_gns" "1.1.1.2.*1::1.*1.1.1.1"
39curl_get "$gns_link?name=www.test_plugin_rest_gns&record_type=A" "1.1.1.2.*1.1.1.1"
40curl_get "$gns_link?name=www.test_plugin_rest_gns&record_type=AAAA" "1::1"
41curl_get "$gns_link?name=www.test_plugin_rest_gns&record_type=WRONG_TYPE" "1.1.1.2.*1::1.*1.1.1.1"
42
43gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www1 -e 1d -V 1.1.1.1 -t A
44curl_get "$gns_link?name=www1.test_plugin_rest_gns" "1.1.1.1"
45
46gnunet-identity -D "test_plugin_rest_gns"
47
48curl_get "$gns_link?name=www1.test_plugin_rest_gns" "error"
49
50exit 0