[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 02/03: fix anastasis API test
From: |
gnunet |
Subject: |
[taler-anastasis] 02/03: fix anastasis API test |
Date: |
Fri, 20 Nov 2020 14:36:02 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit 1a5d3df4a8731f7583a7187cbb68be28f17c7538
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Fri Nov 20 14:20:04 2020 +0100
fix anastasis API test
---
src/backend/anastasis-httpd.c | 14 ++++++--------
src/cli/test_anastasis_reducer.conf | 6 ++++++
src/cli/test_anastasis_reducer_1.conf | 6 ++++++
src/cli/test_anastasis_reducer_2.conf | 6 ++++++
src/cli/test_anastasis_reducer_3.conf | 6 ++++++
src/cli/test_reducer.sh | 10 +++++++---
...test_anastasis_reducer.conf => test_reducerEUWWNI.conf} | 0
src/lib/anastasis.c | 11 +++++++----
src/lib/testing_api_cmd_policy_store.c | 3 ++-
src/lib/testing_cmd_secret_share.c | 11 ++++++++---
src/stasis/plugin_anastasis_postgres.c | 11 +++++------
11 files changed, 59 insertions(+), 25 deletions(-)
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index c866bb7..c665a77 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -771,14 +771,12 @@ main (int argc,
GNUNET_OS_init (ANASTASIS_project_data_default ());
fprintf (stderr, "Here with PID %d, project is %s\n", (int) getpid (),
GNUNET_OS_project_data_get ()->project_dirname);
- if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc, argv,
- "anastasis-httpd",
- "Anastasis HTTP interface",
- options, &run, NULL))
-
- if (GNUNET_SYSERR == res)
- return 3;
+ res = GNUNET_PROGRAM_run (argc, argv,
+ "anastasis-httpd",
+ "Anastasis HTTP interface",
+ options, &run, NULL);
+ if (GNUNET_SYSERR == res)
+ return 3;
if (GNUNET_NO == res)
return 0;
return (GNUNET_OK == result) ? 0 : 1;
diff --git a/src/cli/test_anastasis_reducer.conf
b/src/cli/test_anastasis_reducer.conf
index ca7a6e9..e95b3cd 100644
--- a/src/cli/test_anastasis_reducer.conf
+++ b/src/cli/test_anastasis_reducer.conf
@@ -56,6 +56,12 @@ SUPPORTED_METHODS = question
# Insurance
INSURANCE = TESTKUDOS:1.0
+# Cost of authentication by file (only for testing purposes)
+FILE_COST = TESTKUDOS:1.0
+
+# Server salt 16 Byte
+SERVER_SALT = AUfO1KGOKYIFlFQg
+
# This specifies which database the postgres backend uses.
[anastasisdb-postgres]
CONFIG = postgres:///anastasischeck
diff --git a/src/cli/test_anastasis_reducer_1.conf
b/src/cli/test_anastasis_reducer_1.conf
index 30fba38..502da6b 100644
--- a/src/cli/test_anastasis_reducer_1.conf
+++ b/src/cli/test_anastasis_reducer_1.conf
@@ -51,11 +51,17 @@ QUESTION_COST = TESTKUDOS:0
# Insurance
INSURANCE = TESTKUDOS:1.0
+# Cost of authentication by file (only for testing purposes)
+FILE_COST = TESTKUDOS:1.0
+
# Upload limit
UPLOAD_LIMIT_MB = 1
SUPPORTED_METHODS = question
+# Server salt 16 Byte
+SERVER_SALT = BUfO1KGOKYIFlFQg
+
# This specifies which database the postgres backend uses.
[anastasisdb-postgres]
CONFIG = postgres:///anastasischeck
diff --git a/src/cli/test_anastasis_reducer_2.conf
b/src/cli/test_anastasis_reducer_2.conf
index 173fd4b..e6de4d9 100644
--- a/src/cli/test_anastasis_reducer_2.conf
+++ b/src/cli/test_anastasis_reducer_2.conf
@@ -51,11 +51,17 @@ QUESTION_COST = TESTKUDOS:0
# Insurance
INSURANCE = TESTKUDOS:1.0
+# Cost of authentication by file (only for testing purposes)
+FILE_COST = TESTKUDOS:1.0
+
# Upload limit
UPLOAD_LIMIT_MB = 1
SUPPORTED_METHODS = question
+# Server salt 16 Byte
+SERVER_SALT = CUfO1KGOKYIFlFQg
+
# This specifies which database the postgres backend uses.
[anastasisdb-postgres]
CONFIG = postgres:///anastasischeck
diff --git a/src/cli/test_anastasis_reducer_3.conf
b/src/cli/test_anastasis_reducer_3.conf
index 9a82d0c..b74f5f0 100644
--- a/src/cli/test_anastasis_reducer_3.conf
+++ b/src/cli/test_anastasis_reducer_3.conf
@@ -51,6 +51,12 @@ QUESTION_COST = TESTKUDOS:0
# Insurance
INSURANCE = TESTKUDOS:1.0
+# Cost of authentication by file (only for testing purposes)
+FILE_COST = TESTKUDOS:1.0
+
+# Server salt 16 Byte
+SERVER_SALT = DUfO1KGOKYIFlFQg
+
# Upload limit
UPLOAD_LIMIT_MB = 1
diff --git a/src/cli/test_reducer.sh b/src/cli/test_reducer.sh
index b5e42c7..2f680a4 100755
--- a/src/cli/test_reducer.sh
+++ b/src/cli/test_reducer.sh
@@ -39,17 +39,21 @@ jq -h > /dev/null || exit_skip "jq required"
echo " FOUND"
echo -n "Testing for taler"
-taler-exchange-httpd -h > /dev/null || exit_skip "taler-exchange required"
-taler-merchant-httpd -h > /dev/null || exit_skip "taler-merchant required"
+taler-exchange-httpd -h > /dev/null || exit_skip " taler-exchange required"
+taler-merchant-httpd -h > /dev/null || exit_skip " taler-merchant required"
echo " FOUND"
echo -n "Testing for taler-bank-manage"
-taler-bank-manage -h >/dev/null </dev/null || exit_skip " MISSING"
+taler-bank-manage --help >/dev/null </dev/null || exit_skip " MISSING"
echo " FOUND"
echo -n "Testing for taler-wallet-cli"
taler-wallet-cli -v >/dev/null </dev/null || exit_skip " MISSING"
echo " FOUND"
+echo -n "Testing for anastasis-httpd "
+anastasis-httpd -h >/dev/null </dev/null || exit_skip " MISSING"
+echo " FOUND"
+
diff --git a/src/cli/test_anastasis_reducer.conf
b/src/cli/test_reducerEUWWNI.conf
similarity index 100%
copy from src/cli/test_anastasis_reducer.conf
copy to src/cli/test_reducerEUWWNI.conf
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 8805364..f107fb0 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -1531,6 +1531,7 @@ policy_store_cb (void *cls,
So if you hit this, you might just want to modify
the code here to handle this better! */
+ GNUNET_break (0);
return;
}
pss->payment_order_id = GNUNET_strdup (&m[strlen ("/-/-/")]);
@@ -1550,8 +1551,9 @@ policy_store_cb (void *cls,
ec);
pss->ss->spc = NULL;
}
- ANASTASIS_secret_share_cancel (pss->ss);
- policy_store_cleanup (pss);
+ // FIXME: Wrong place for cleanup!
+ // ANASTASIS_secret_share_cancel (pss->ss);
+ // policy_store_cleanup (pss);
}
return;
case ANASTASIS_US_CONFLICTING_POLICY:
@@ -1578,8 +1580,9 @@ policy_store_cb (void *cls,
http_status);
pss->ss->src = NULL;
}
- ANASTASIS_secret_share_cancel (pss->ss);
- policy_store_cleanup (pss);
+ // FIXME: Wrong place for cleanup!
+ // ANASTASIS_secret_share_cancel (pss->ss);
+ // policy_store_cleanup (pss);
}
}
diff --git a/src/lib/testing_api_cmd_policy_store.c
b/src/lib/testing_api_cmd_policy_store.c
index 3750d20..0b3216b 100644
--- a/src/lib/testing_api_cmd_policy_store.c
+++ b/src/lib/testing_api_cmd_policy_store.c
@@ -207,7 +207,8 @@ policy_store_cb (void *cls,
the above token must appear in the payment request!
So if you hit this, you might just want to modify
- the code here to handle this better! */return;
+ the code here to handle this better! */
+ return;
}
pss->payment_order_id = GNUNET_strdup (&m[strlen ("/-/-/")]);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/lib/testing_cmd_secret_share.c
b/src/lib/testing_cmd_secret_share.c
index c63b83b..8e1edb4 100644
--- a/src/lib/testing_cmd_secret_share.c
+++ b/src/lib/testing_cmd_secret_share.c
@@ -135,6 +135,10 @@ secret_share_payment_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"At %s:%d we are in SPC\n",
__FILE__, __LINE__);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "At %s:%d the taler pay url is %s\n",
+ __FILE__, __LINE__,
+ taler_pay_url);
if (sss->http_status != MHD_HTTP_PAYMENT_REQUIRED)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -156,7 +160,7 @@ secret_share_payment_cb (void *cls,
"Did not find `%s' in `%s'\n",
"/-/-/",
taler_pay_url);
- GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (sss->is);
return;
}
m = strstr (taler_pay_url, "/-/-/");
@@ -166,6 +170,7 @@ secret_share_payment_cb (void *cls,
"Did not find `%s' in `%s'\n",
"/-/-/",
taler_pay_url);
+ TALER_TESTING_interpreter_fail (sss->is);
/* NOTE: The above is a simplifying assumption for the
test-logic, hitting this code merely means that
the assumptions for the test (i.e. no instance) are
@@ -173,7 +178,8 @@ secret_share_payment_cb (void *cls,
the above token must appear in the payment request!
So if you hit this, you might just want to modify
- the code here to handle this better! */return;
+ the code here to handle this better! */
+ return;
}
sss->payment_order_id = GNUNET_strdup (&m[strlen ("/-/-/")]);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -233,7 +239,6 @@ secret_share_result_cb (void *cls,
return;
}
TALER_TESTING_interpreter_fail (sss->is);
- return;
}
diff --git a/src/stasis/plugin_anastasis_postgres.c
b/src/stasis/plugin_anastasis_postgres.c
index b518b62..c021454 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -362,12 +362,12 @@ payment_by_account_cb (void *cls,
struct PaymentIteratorContext *pic = cls;
for (unsigned int i = 0; i < num_results; i++)
{
- struct GNUNET_TIME_Absolute timestamp;
+ struct GNUNET_TIME_Absolute creation_date;
struct ANASTASIS_PaymentSecretP payment_identifier;
struct TALER_Amount amount;
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_absolute_time ("timestamp",
- ×tamp),
+ GNUNET_PQ_result_spec_absolute_time ("creation_date",
+ &creation_date),
GNUNET_PQ_result_spec_auto_from_type ("payment_identifier",
&payment_identifier),
TALER_PQ_result_spec_amount ("amount",
@@ -391,7 +391,7 @@ payment_by_account_cb (void *cls,
ANASTASIS_PaymentSecretP));
pic->qs = i + 1;
pic->it (pic->it_cls,
- timestamp,
+ creation_date,
order_id,
&amount);
GNUNET_PQ_cleanup_result (rs);
@@ -1983,7 +1983,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
",creation_date"
") VALUES "
"($1, $2, $3, $4, $5, $6);",
- 4),
+ 6),
GNUNET_PQ_make_prepare ("challenge_payment_insert",
"INSERT INTO anastasis_challenge_payment "
"(truth_public_key"
@@ -2197,7 +2197,6 @@ libanastasis_plugin_db_postgres_init (void *cls)
"AND expiration_date > $2 "
"AND retry_counter > 0;",
2),
-
GNUNET_PQ_make_prepare ("challengecode_update_retry",
"UPDATE anastasis_challengecode "
"SET "
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.