gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: done_auth test


From: gnunet
Subject: [taler-anastasis] branch master updated: done_auth test
Date: Wed, 24 Feb 2021 22:51:41 +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 9739a21  done_auth test
9739a21 is described below

commit 9739a21f293c5d9eeab15cd881d384d33e07d19c
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Feb 24 22:51:39 2021 +0100

    done_auth test
---
 src/cli/Makefile.am                                |   2 +-
 src/cli/resources/05-backup.json                   | 215 +++++++++++++++++++++
 .../test_anastasis_reducer_done_authentication.sh  |  29 +--
 3 files changed, 231 insertions(+), 15 deletions(-)

diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index c3f0d32..3e37fb1 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -15,7 +15,7 @@ check_SCRIPTS = \
   test_anastasis_reducer_select_country.sh \
   test_anastasis_reducer_backup_enter_user_attributes.sh \
   test_anastasis_reducer_add_authentication.sh
-#  test_anastasis_reducer_done_authentication.sh \
+  test_anastasis_reducer_done_authentication.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/05-backup.json b/src/cli/resources/05-backup.json
new file mode 100644
index 0000000..0599833
--- /dev/null
+++ b/src/cli/resources/05-backup.json
@@ -0,0 +1,215 @@
+{
+  "continents": [
+    "Europe",
+    "North America",
+    "Testcontinent"
+  ],
+  "backup_state": "POLICIES_REVIEWING",
+  "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_done_authentication.sh 
b/src/cli/test_anastasis_reducer_done_authentication.sh
index 861d3e5..d3b8da7 100755
--- a/src/cli/test_anastasis_reducer_done_authentication.sh
+++ b/src/cli/test_anastasis_reducer_done_authentication.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,10 +26,6 @@ function cleanup()
 }
 
 # Install cleanup handler (except for kill -9)
-AFN=`which anastasis-reducer`
-ADN=`dirname $AFN`
-RESOURCES=$ADN/../share/anastasis
-SFILE=$RESOURCES/test_reducer_stateAESTATE_FINAL
 TFILE=`mktemp test_reducer_stateXXXXXX`
 
 trap cleanup EXIT
@@ -39,15 +35,18 @@ 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"
+
+
+echo -n "Test failing done authentication (next) ..."
+anastasis-reducer next resources/03-backup.json $TFILE 2> /dev/null && 
exit_fail "Should have failed without challenges"
 
-# Test done authentication in a backup state
-echo " "
-echo "Test done authentication (next) in a backup state"
-./anastasis-reducer -a \
-  '{}' \
-  next $SFILE $TFILE
+echo " OK"
+
+echo -n "Test done authentication (next) ..."
+anastasis-reducer next resources/04-backup.json $TFILE
 
 STATE=`jq -r -e .backup_state < $TFILE`
 if test "$STATE" != "POLICIES_REVIEWING"
@@ -61,4 +60,6 @@ then
     exit_fail "Expected policy 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]