From 741916af1dee72af1ba24a1c9e4fb40f63b2a0a1 Mon Sep 17 00:00:00 2001 From: Phil Date: Mon, 6 Aug 2018 02:09:57 +0200 Subject: GNS REST API finished --- 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..fca35ee2d --- /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?name=www.test_plugin_rest_gns" "error" + +gnunet-identity -C "test_plugin_rest_gns" + +curl_get "$gns_link?name=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?name=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?name=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?name=www.test_plugin_rest_gns" "1.1.1.2.*1::1.*1.1.1.1" +curl_get "$gns_link?name=www.test_plugin_rest_gns&record_type=A" "1.1.1.2.*1.1.1.1" +curl_get "$gns_link?name=www.test_plugin_rest_gns&record_type=AAAA" "1::1" +curl_get "$gns_link?name=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?name=www1.test_plugin_rest_gns" "1.1.1.1" + +gnunet-identity -D "test_plugin_rest_gns" + +curl_get "$gns_link?name=www1.test_plugin_rest_gns" "error" + +exit 0 -- cgit v1.2.3 From 65f9785e7752b6d73e2ad8c6ff2735336ad5baa6 Mon Sep 17 00:00:00 2001 From: Phil Date: Mon, 6 Aug 2018 02:26:04 +0200 Subject: fix gns and identity test script --- src/gns/plugin_rest_gns.c | 3 +-- src/gns/test_plugin_rest_gns.sh | 2 +- src/identity/test_plugin_rest_identity.sh | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src/gns/test_plugin_rest_gns.sh') diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index 4be583f73..495d01504 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c @@ -32,6 +32,7 @@ #define GNUNET_REST_API_NS_GNS "/gns" + #define GNUNET_REST_GNS_PARAM_NAME "name" #define GNUNET_REST_GNS_PARAM_RECORD_TYPE "record_type" @@ -56,7 +57,6 @@ struct Plugin }; - struct RequestHandle { @@ -208,7 +208,6 @@ handle_gns_response (void *cls, struct MHD_Response *resp; json_t *result_array; json_t *record_obj; - char *record_value; char *result; handle->gns_lookup = NULL; diff --git a/src/gns/test_plugin_rest_gns.sh b/src/gns/test_plugin_rest_gns.sh index fca35ee2d..7ede44501 100755 --- a/src/gns/test_plugin_rest_gns.sh +++ b/src/gns/test_plugin_rest_gns.sh @@ -10,7 +10,7 @@ curl_get () { #$1 is link #$2 is grep cache="$(curl -v "$1" 2>&1 | grep "$2")" - echo $cache + #echo $cache if [ "" == "$cache" ] then exit 1 diff --git a/src/identity/test_plugin_rest_identity.sh b/src/identity/test_plugin_rest_identity.sh index 22a7a53c6..d9377500e 100755 --- a/src/identity/test_plugin_rest_identity.sh +++ b/src/identity/test_plugin_rest_identity.sh @@ -3,8 +3,6 @@ #First, start gnunet-arm and the rest-service. #Exit 0 means success, exit 1 means failed test -#No test for subsystem available - identity_link="http://localhost:7776/identity" wrong_link="http://localhost:7776/identityandmore" -- cgit v1.2.3