gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: fix tests


From: gnunet
Subject: [taler-anastasis] branch master updated: fix tests
Date: Mon, 29 Mar 2021 14:07:24 +0200

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 3e331b3  fix tests
3e331b3 is described below

commit 3e331b36a06aad4e482631914ef4ecd931411185
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Mar 29 14:07:21 2021 +0200

    fix tests
---
 contrib/redux.xx.json                              |  2 +-
 contrib/redux.xy.json                              | 13 ++++++++++++
 src/cli/resources/02-backup.json                   | 23 +++++++++++-----------
 src/cli/resources/02-recovery.json                 | 23 +++++++++++-----------
 src/cli/resources/03-backup.json                   |  8 +++-----
 src/cli/resources/04-backup.json                   |  6 ++----
 src/cli/resources/05-backup.json                   |  8 +++-----
 ...astasis_reducer_backup_enter_user_attributes.sh | 14 +++++--------
 ...tasis_reducer_recovery_enter_user_attributes.sh |  8 +++-----
 src/reducer/anastasis_api_redux.c                  | 12 ++++++++++-
 10 files changed, 65 insertions(+), 52 deletions(-)

diff --git a/contrib/redux.xx.json b/contrib/redux.xx.json
index 561987c..b6146e7 100644
--- a/contrib/redux.xx.json
+++ b/contrib/redux.xx.json
@@ -34,7 +34,7 @@
                "de_DE":"Quadratzahl",
                "de_CH":"Quadratzahl"
            },
-           "widget": "anastasis_gtk_xx_sqare",
+           "widget": "anastasis_gtk_xx_square",
             "uuid" : "ed790bca-89bf-11eb-96f2-233996cf644e",
            "validation-regex": "^[0-9]+$",
            "validation-logic": "XX_SQUARE_check"
diff --git a/contrib/redux.xy.json b/contrib/redux.xy.json
index db30eba..d7c32d1 100644
--- a/contrib/redux.xy.json
+++ b/contrib/redux.xy.json
@@ -26,5 +26,18 @@
            "widget": "anastasis_gtk_ia_birthdate",
             "uuid" : "83d655c7-bdb6-484d-904e-80c1058c8854"
        },
+       {
+           "type": "string",
+           "name": "prime_number",
+           "label": "Prime number",
+           "label_i18n":{
+               "de_DE":"Primzahl",
+               "de_CH":"Primzahl"
+           },
+           "widget": "anastasis_gtk_xx_prime",
+            "uuid" : "39190a95-cacb-4412-8bae-1f7da3f980b4",
+           "validation-regex": "^[0-9]+$",
+           "validation-logic": "XY_PRIME_check"
+       }
     ]
 }
diff --git a/src/cli/resources/02-backup.json b/src/cli/resources/02-backup.json
index b0fb871..be35cdc 100644
--- a/src/cli/resources/02-backup.json
+++ b/src/cli/resources/02-backup.json
@@ -67,16 +67,17 @@
       "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"
+        "type": "string",
+        "name": "sq_number",
+       "label": "Square number",
+       "label_i18n":{
+           "de_DE":"Quadratzahl",
+           "de_CH":"Quadratzahl"
+       },
+       "widget": "anastasis_gtk_xx_square",
+        "uuid" : "ed790bca-89bf-11eb-96f2-233996cf644e",
+       "validation-regex": "^[0-9]+$",
+       "validation-logic": "XX_SQUARE_check"
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/src/cli/resources/02-recovery.json 
b/src/cli/resources/02-recovery.json
index 2fa7449..93804e6 100644
--- a/src/cli/resources/02-recovery.json
+++ b/src/cli/resources/02-recovery.json
@@ -67,16 +67,17 @@
       "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"
+        "type": "string",
+        "name": "sq_number",
+       "label": "Square number",
+       "label_i18n":{
+           "de_DE":"Quadratzahl",
+           "de_CH":"Quadratzahl"
+       },
+       "widget": "anastasis_gtk_xx_square",
+        "uuid" : "ed790bca-89bf-11eb-96f2-233996cf644e",
+       "validation-regex": "^[0-9]+$",
+       "validation-logic": "XX_SQUARE_check"
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/src/cli/resources/03-backup.json b/src/cli/resources/03-backup.json
index 3012663..c69126f 100644
--- a/src/cli/resources/03-backup.json
+++ b/src/cli/resources/03-backup.json
@@ -149,9 +149,7 @@
   ],
   "identity_attributes": {
     "full_name": "Max Musterman",
-    "ahv_number": "756.9217.0769.85",
-    "birth_year": 2000,
-    "birth_month": 1,
-    "birth_day": 1
+    "sq_number": 4,
+    "birthdate": "2000-01-01"
   }
-}
\ No newline at end of file
+}
diff --git a/src/cli/resources/04-backup.json b/src/cli/resources/04-backup.json
index 404580c..7e42311 100644
--- a/src/cli/resources/04-backup.json
+++ b/src/cli/resources/04-backup.json
@@ -149,10 +149,8 @@
   ],
   "identity_attributes": {
     "full_name": "Max Musterman",
-    "ahv_number": "756.9217.0769.85",
-    "birth_year": 2000,
-    "birth_month": 1,
-    "birth_day": 1
+    "sq_number": 4,
+    "birthdate": "2000-01-01"
   },
   "authentication_methods": [
     {
diff --git a/src/cli/resources/05-backup.json b/src/cli/resources/05-backup.json
index 0599833..a55a608 100644
--- a/src/cli/resources/05-backup.json
+++ b/src/cli/resources/05-backup.json
@@ -149,10 +149,8 @@
   ],
   "identity_attributes": {
     "full_name": "Max Musterman",
-    "ahv_number": "756.9217.0769.85",
-    "birth_year": 2000,
-    "birth_month": 1,
-    "birth_day": 1
+    "sq_number": 4,
+    "birthdate": "2000-01-01"
   },
   "authentication_methods": [
     {
@@ -212,4 +210,4 @@
       ]
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/src/cli/test_anastasis_reducer_backup_enter_user_attributes.sh 
b/src/cli/test_anastasis_reducer_backup_enter_user_attributes.sh
index e68149d..7db0dae 100755
--- a/src/cli/test_anastasis_reducer_backup_enter_user_attributes.sh
+++ b/src/cli/test_anastasis_reducer_backup_enter_user_attributes.sh
@@ -103,13 +103,11 @@ echo " OK"
 
 # Test user attributes collection in a backup state
 echo -n "Test user attributes collection in a backup state ..."
-anastasis-reducer -a \
+anastasis-reducer -L WARNING -a \
   '{"identity_attributes": {
     "full_name": "Max Musterman",
-    "ahv_number": "756.9217.0769.85",
-    "birth_year": 2000,
-    "birth_month": 1,
-    "birth_day": 1}}' \
+    "sq_number": "4",
+    "birthdate": "2000-01-01"}}' \
   enter_user_attributes resources/02-backup.json $TFILE
 
 STATE=`jq -r -e .backup_state < $TFILE`
@@ -131,10 +129,8 @@ echo -n "Test user attributes collection in a recovery 
state ..."
 anastasis-reducer -a \
   '{"identity_attributes": {
     "full_name": "Max Musterman",
-    "ahv_number": "756.9217.0769.85",
-    "birth_year": 2000,
-    "birth_month": 1,
-    "birth_day": 1}}' \
+    "sq_number": "4",
+    "birthdate": "2000-01-01"}}' \
   enter_user_attributes resources/02-recovery.json $TFILE 2> /dev/null && 
exit_fail "Expected recovery to fail due to lacking policy data"
 
 CODE=`jq -r -e .code < $TFILE`
diff --git a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh 
b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
index edd9bd6..771f974 100755
--- a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
+++ b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
@@ -283,10 +283,8 @@ echo -n "."
 anastasis-reducer -a \
   '{"identity_attributes": {
     "full_name": "Max Musterman",
-    "ahv_number": "756.9217.0769.85",
-    "birth_year": 2000,
-    "birth_month": 1,
-    "birth_day": 1}}' \
+    "sq_number": "4",
+    "birthdate": "2000-01-01"}}' \
   enter_user_attributes < $B1FILE > $B2FILE
 echo -n ","
 # "91GPWWR" encodes "Hans"
@@ -404,7 +402,7 @@ anastasis-reducer -a \
   '{"country_code": "xx",
     "currency":"TESTKUDOS"}' \
   select_country < $R2FILE > $R1FILE
-anastasis-reducer -a '{"identity_attributes": { "full_name": "Max Musterman", 
"ahv_number": "756.9217.0769.85", "birth_year": 2000, "birth_month": 1, 
"birth_day": 1}}' enter_user_attributes < $R1FILE > $R2FILE
+anastasis-reducer -a '{"identity_attributes": { "full_name": "Max Musterman", 
"sq_number": "4", "birthdate": "2000-01-01" }}' enter_user_attributes < $R1FILE 
> $R2FILE
 
 
 STATE=`jq -r -e .recovery_state < $R2FILE`
diff --git a/src/reducer/anastasis_api_redux.c 
b/src/reducer/anastasis_api_redux.c
index 8211b40..05a6870 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -1227,9 +1227,19 @@ enter_user_attributes (json_t *state,
                                "'required_attributes' lacks required fields");
         return NULL;
       }
-
       attribute_value = json_string_value (json_object_get (attributes,
                                                             name));
+      if (NULL == attribute_value)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "Request is missing required attribute `%s'\n",
+                    name);
+        ANASTASIS_redux_fail_ (cb,
+                               cb_cls,
+                               TALER_EC_GENERIC_PARAMETER_MISSING,
+                               name);
+        return NULL;
+      }
       if ( (NULL != regexp) &&
            (! validate_regex (attribute_value,
                               regexp)) )

-- 
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]