aboutsummaryrefslogtreecommitdiff
path: root/src/gns/test_plugin_rest_gns.sh
diff options
context:
space:
mode:
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..fca35ee2d
--- /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