gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: expand test


From: gnunet
Subject: [taler-anastasis] branch master updated: expand test
Date: Sun, 28 Feb 2021 18:30:00 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new e3c2d0e  expand test
e3c2d0e is described below

commit e3c2d0eb94914bc3bce10f6bb5fc5e047187adea
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Feb 28 18:29:57 2021 +0100

    expand test
---
 contrib/gana                                       |   2 +-
 src/cli/Makefile.am                                |   6 +-
 src/cli/resources/06-backup.json                   | 215 +++++++++++++++++++++
 .../test_anastasis_reducer_add_authentication.sh   |   4 -
 .../test_anastasis_reducer_done_policy_review.sh   |  39 ++--
 5 files changed, 239 insertions(+), 27 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 943729d..4c5ae13 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 943729d4e2c2d97c3b5d737cf76b388086d94378
+Subproject commit 4c5ae13bf6c7e3cb070e9d56065cfdfc053f0b3a
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index 3e37fb1..d1751e7 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -14,10 +14,10 @@ check_SCRIPTS = \
   test_anastasis_reducer_select_continent.sh \
   test_anastasis_reducer_select_country.sh \
   test_anastasis_reducer_backup_enter_user_attributes.sh \
-  test_anastasis_reducer_add_authentication.sh
+  test_anastasis_reducer_add_authentication.sh \
   test_anastasis_reducer_done_authentication.sh \
-#  test_anastasis_reducer_done_policy_review.sh \
-#  test_anastasis_reducer_enter_secret.sh \
+  test_anastasis_reducer_done_policy_review.sh
+#  test_anastasis_reducer_enter_secret.sh
 #  test_anastasis_reducer_recovery_enter_user_attributes.sh
 
 
diff --git a/src/cli/resources/06-backup.json b/src/cli/resources/06-backup.json
new file mode 100644
index 0000000..f305632
--- /dev/null
+++ b/src/cli/resources/06-backup.json
@@ -0,0 +1,215 @@
+{
+  "continents": [
+    "Europe",
+    "North America",
+    "Testcontinent"
+  ],
+  "backup_state": "SECRET_EDITING",
+  "selected_continent": "Testcontinent",
+  "countries": [
+    {
+      "code": "xx",
+      "name": "Testland",
+      "continent": "Testcontinent",
+      "continent_i18n": {
+        "xx": "Testkontinent"
+      },
+      "name_i18n": {
+        "de_DE": "Testlandt",
+        "de_CH": "Testlandi",
+        "fr": "Testpais",
+        "en": "Testland"
+      },
+      "currency": "TESTKUDOS"
+    },
+    {
+      "code": "xy",
+      "name": "Demoland",
+      "continent": "Testcontinent",
+      "continent_i18n": {
+        "xx": "Testkontinent"
+      },
+      "name_i18n": {
+        "de_DE": "Demolandt",
+        "de_CH": "Demolandi",
+        "fr": "Demopais",
+        "en": "Demoland"
+      },
+      "currency": "KUDOS"
+    }
+  ],
+  "authentication_providers": {
+    "http://localhost:8086/": {
+      "methods": [
+        {
+          "type": "question",
+          "usage_fee": "TESTKUDOS:0"
+        }
+      ],
+      "annual_fee": "TESTKUDOS:4.99",
+      "truth_upload_fee": "TESTKUDOS:0.01",
+      "liability_limit": "TESTKUDOS:1",
+      "truth_lifetime": {
+        "d_ms": 63115200000
+      },
+      "currency": "TESTKUDOS",
+      "business_name": "Data loss #1 Inc.",
+      "storage_limit_in_megabytes": 1,
+      "salt": "F0HEYJQW81ZAZ3VYMZHFG8T1Z0"
+    },
+    "http://localhost:8087/": {
+      "methods": [
+        {
+          "type": "question",
+          "usage_fee": "TESTKUDOS:0"
+        }
+      ],
+      "annual_fee": "TESTKUDOS:4.99",
+      "truth_upload_fee": "TESTKUDOS:0.01",
+      "liability_limit": "TESTKUDOS:1",
+      "truth_lifetime": {
+        "d_ms": 63115200000
+      },
+      "currency": "TESTKUDOS",
+      "business_name": "Data loss #2 Inc.",
+      "storage_limit_in_megabytes": 1,
+      "salt": "D378FWXHJB8JHPQFQRZGGV9PWG"
+    },
+    "http://localhost:8088/": {
+      "methods": [
+        {
+          "type": "question",
+          "usage_fee": "TESTKUDOS:0"
+        }
+      ],
+      "annual_fee": "TESTKUDOS:4.99",
+      "truth_upload_fee": "TESTKUDOS:0.01",
+      "liability_limit": "TESTKUDOS:1",
+      "truth_lifetime": {
+        "d_ms": 63115200000
+      },
+      "currency": "TESTKUDOS",
+      "business_name": "Data loss #3 Inc.",
+      "storage_limit_in_megabytes": 1,
+      "salt": "7W9W4A4TTWSWRPJ76RNDPJHSPR"
+    },
+    "http://localhost:8089/": {
+      "methods": [
+        {
+          "type": "question",
+          "usage_fee": "TESTKUDOS:0"
+        }
+      ],
+      "annual_fee": "TESTKUDOS:4.99",
+      "truth_upload_fee": "TESTKUDOS:0.01",
+      "liability_limit": "TESTKUDOS:1",
+      "truth_lifetime": {
+        "d_ms": 63115200000
+      },
+      "currency": "TESTKUDOS",
+      "business_name": "Data loss #4 Inc.",
+      "storage_limit_in_megabytes": 1,
+      "salt": "PN0VJF6KDSBYN40SGRCEXPB07M"
+    }
+  },
+  "selected_country": "xx",
+  "currency": "TESTKUDOS",
+  "required_attributes": [
+    {
+      "type": "string",
+      "name": "full_name",
+      "label": "Full name",
+      "label_i18n": {
+        "de_DE": "Vollstaendiger Name",
+        "de_CH": "Vollstaendiger Name"
+      },
+      "widget": "anastasis_gtk_ia_full_name"
+    },
+    {
+      "type": "date",
+      "name": "birthdate",
+      "label": "Birthdate",
+      "label_i18n": {
+        "de_CH": "Geburtsdatum"
+      },
+      "widget": "anastasis_gtk_ia_birthdate"
+    },
+    {
+      "type": "string",
+      "name": "ahv_number",
+      "label": "AHV number",
+      "label_i18n": {
+        "de_DE": "AHV-Nummer",
+        "de_CH": "AHV-Nummer"
+      },
+      "widget": "anastasis_gtk_ia_ahv",
+      "validation-regex": "^(756).[0-9]{4}.[0-9]{4}.[0-9]{2}|(756)[0-9]{10}$",
+      "validation-logic": "CH_AVH_check"
+    }
+  ],
+  "identity_attributes": {
+    "full_name": "Max Musterman",
+    "ahv_number": "756.9217.0769.85",
+    "birth_year": 2000,
+    "birth_month": 1,
+    "birth_day": 1
+  },
+  "authentication_methods": [
+    {
+      "type": "question",
+      "instructions": "Whats your name?",
+      "challenge": "Hans"
+    },
+    {
+      "type": "question",
+      "instructions": "Whats x your name?",
+      "challenge": "Hansx"
+    },
+    {
+      "type": "question",
+      "instructions": "Where do you live?",
+      "challenge": "Mars"
+    }
+  ],
+  "policies": [
+    {
+      "recovery_cost": "TESTKUDOS:0",
+      "methods": [
+        {
+          "authentication_method": 0,
+          "provider": "http://localhost:8089/";
+        },
+        {
+          "authentication_method": 1,
+          "provider": "http://localhost:8088/";
+        }
+      ]
+    },
+    {
+      "recovery_cost": "TESTKUDOS:0",
+      "methods": [
+        {
+          "authentication_method": 0,
+          "provider": "http://localhost:8089/";
+        },
+        {
+          "authentication_method": 2,
+          "provider": "http://localhost:8088/";
+        }
+      ]
+    },
+    {
+      "recovery_cost": "TESTKUDOS:0",
+      "methods": [
+        {
+          "authentication_method": 1,
+          "provider": "http://localhost:8089/";
+        },
+        {
+          "authentication_method": 2,
+          "provider": "http://localhost:8088/";
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/src/cli/test_anastasis_reducer_add_authentication.sh 
b/src/cli/test_anastasis_reducer_add_authentication.sh
index c42d352..402cae9 100755
--- a/src/cli/test_anastasis_reducer_add_authentication.sh
+++ b/src/cli/test_anastasis_reducer_add_authentication.sh
@@ -40,10 +40,6 @@ echo -n "Testing for anastasis-reducer ..."
 anastasis-reducer -h > /dev/null || exit_skip "anastasis-reducer required"
 echo " FOUND"
 
-echo -n "Testing for anastasis-httpd"
-anastasis-httpd -h >/dev/null </dev/null || exit_skip " MISSING"
-echo " FOUND"
-
 echo -n "Test add authentication ..."
 
 # First method
diff --git a/src/cli/test_anastasis_reducer_done_policy_review.sh 
b/src/cli/test_anastasis_reducer_done_policy_review.sh
index 0077dab..09ca55c 100755
--- a/src/cli/test_anastasis_reducer_done_policy_review.sh
+++ b/src/cli/test_anastasis_reducer_done_policy_review.sh
@@ -4,13 +4,13 @@ set -eu
 
 # Exit, with status code "skip" (no 'real' failure)
 function exit_skip() {
-    echo $1
+    echo " SKIP: $1"
     exit 77
 }
 
 # Exit, with error message (hard failure)
 function exit_fail() {
-    echo $1
+    echo " ERROR: $1"
     exit 1
 }
 
@@ -26,39 +26,40 @@ function cleanup()
 }
 
 # Install cleanup handler (except for kill -9)
-AFN=`which anastasis-reducer`
-ADN=`dirname $AFN`
-RESOURCES=$ADN/../share/anastasis
-SFILE=$RESOURCES/test_reducer_statePRSTATE
 TFILE=`mktemp test_reducer_stateXXXXXX`
-
 trap cleanup EXIT
 
+
 # Check we can actually run
-echo -n "Testing for jq"
+echo -n "Testing for jq ..."
 jq -h > /dev/null || exit_skip "jq required"
 echo " FOUND"
 
-echo " "
-echo "Beginning with actual reducer test"
+echo -n "Testing for anastasis-reducer ..."
+anastasis-reducer -h > /dev/null || exit_skip "anastasis-reducer required"
+echo " FOUND"
 
-# Test done policy review in a backup state
-echo " "
-echo "Test done policy review (next) in a backup state"
-./anastasis-reducer -a \
-  '{}' \
-  next $SFILE $TFILE
+echo -n "Test done policy review (next) in a backup state ..."
+anastasis-reducer next resources/05-backup.json $TFILE
 
 STATE=`jq -r -e .backup_state < $TFILE`
 if test "$STATE" != "SECRET_EDITING"
 then
-    exit_fail "Expected new state to be SECRET_EDITING, got $STATE"
+    exit_fail "Expected new state to be 'SECRET_EDITING', got '$STATE'"
+fi
+
+ARRAY_LENGTH=`jq -r -e '.authentication_methods | length' < $TFILE`
+if test $ARRAY_LENGTH -lt 3
+then
+    exit_fail "Expected auth methods array length to be >= 3, got 
$ARRAY_LENGTH"
 fi
 
-ARRAY_LENGTH=`jq -r -e '.truths | length' < $TFILE`
+ARRAY_LENGTH=`jq -r -e '.policies | length' < $TFILE`
 if test $ARRAY_LENGTH -lt 3
 then
-    exit_fail "Expected truths array length to be >= 3, got $ARRAY_LENGTH"
+    exit_fail "Expected policies array length to be >= 3, got $ARRAY_LENGTH"
 fi
 
+echo " OK"
+
 exit 0

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]