From 1057efede9f4d08ff9d215162a7ebdeea4869e20 Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Tue, 12 Mar 2019 09:46:15 +0100 Subject: move rest tests --- src/gns/test_plugin_rest_gns.sh | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 src/gns/test_plugin_rest_gns.sh (limited to 'src/gns/test_plugin_rest_gns.sh') diff --git a/src/gns/test_plugin_rest_gns.sh b/src/gns/test_plugin_rest_gns.sh new file mode 100755 index 000000000..ec495a04b --- /dev/null +++ b/src/gns/test_plugin_rest_gns.sh @@ -0,0 +1,50 @@ +#!/usr/bin/bash + +#First, start gnunet-arm and the rest-service. +#Exit 0 means success, exit 1 means failed test + +gns_link="http://localhost:7776/gns" +wrong_link="http://localhost:7776/gnsandmore" + +curl_get () { + #$1 is link + #$2 is grep + cache="$(curl -v "$1" 2>&1 | grep "$2")" + #echo $cache + if [ "" == "$cache" ] + then + exit 1 + fi +} + +gnunet-identity -D "test_plugin_rest_gns" > /dev/null 2>&1 + +curl_get "$gns_link/www.test_plugin_rest_gns" "error" + +gnunet-identity -C "test_plugin_rest_gns" + +curl_get "$gns_link/www.test_plugin_rest_gns" "\[\]" + +gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1.1.1.1 -t A + +curl_get "$gns_link/www.test_plugin_rest_gns" "1.1.1.1" + +gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1::1 -t AAAA + +curl_get "$gns_link/www.test_plugin_rest_gns" "1::1.*1.1.1.1" + +gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www -e 1d -V 1.1.1.2 -t A + +curl_get "$gns_link/www.test_plugin_rest_gns" "1.1.1.2.*1::1.*1.1.1.1" +curl_get "$gns_link/www.test_plugin_rest_gns?record_type=A" "1.1.1.2.*1.1.1.1" +curl_get "$gns_link/www.test_plugin_rest_gns?record_type=AAAA" "1::1" +curl_get "$gns_link/www.test_plugin_rest_gns?record_type=WRONG_TYPE" "1.1.1.2.*1::1.*1.1.1.1" + +gnunet-namestore -z "test_plugin_rest_gns" -p -a -n www1 -e 1d -V 1.1.1.1 -t A +curl_get "$gns_link/www1.test_plugin_rest_gns" "1.1.1.1" + +gnunet-identity -D "test_plugin_rest_gns" > /dev/null 2>&1 + +curl_get "$gns_link/www1.test_plugin_rest_gns" "error" + +exit 0 -- cgit v1.2.3