diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-02-19 11:47:07 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-02-19 11:47:07 +0100 |
commit | fdf1da57b25121dadeb110f013caf55d0de43046 (patch) | |
tree | ad2c7166756281f6051b6698d860e0797e0b2201 | |
parent | 1954f2dee9545c89012dc3215769f044f323dc92 (diff) |
-doxygen fixes and configuration fixes
m--------- | contrib/wallet-core | 0 | ||||
-rw-r--r-- | src/include/taler_merchant_testing_lib.h | 32 | ||||
-rw-r--r-- | src/testing/Makefile.am | 1 | ||||
-rw-r--r-- | src/testing/test.conf | 1 | ||||
-rw-r--r-- | src/testing/test_merchant_api-cs.conf | 125 | ||||
-rw-r--r-- | src/testing/test_merchant_api-rsa.conf | 125 | ||||
-rw-r--r-- | src/testing/test_merchant_api.conf | 124 | ||||
-rw-r--r-- | src/testing/test_template.conf | 1 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_checkserver.c | 141 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_webhook.c | 13 |
10 files changed, 217 insertions, 346 deletions
diff --git a/contrib/wallet-core b/contrib/wallet-core -Subproject abc01ba21f670960df8a79047d536f16c263183 +Subproject 13119702d90733174fc69a75de46bda6401d083 diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h index e0ffcccf..a749b092 100644 --- a/src/include/taler_merchant_testing_lib.h +++ b/src/include/taler_merchant_testing_lib.h @@ -1771,7 +1771,7 @@ TALER_TESTING_cmd_merchant_delete_webhook (const char *label, * to use the 'taler-merchant-webhook' program. * * @param label command label. - * @param configuration file used by the webhook. + * @param config_filename configuration file used by the webhook. */ struct TALER_TESTING_Command TALER_TESTING_cmd_webhook (const char *label, @@ -1790,22 +1790,40 @@ TALER_TESTING_cmd_testserver (const char *label, /** - * This function is used to check the web server + * This function is used to check the web server got the + * expected request from the web hook. * * @param label command label * @param ref_operation reference to command to the previous set server status operation. * @param index index to know which web server we check. - * @param url of the webhook - * @param http_method of the webhook - * @param header of the webhook - * @param body of the webhook - * @param port is the port of the web server */ struct TALER_TESTING_Command TALER_TESTING_cmd_checkserver (const char *label, const char *ref_operation, unsigned int index); + +/** + * This function is used to check that the web server + * got the expected request from the web hook. + * + * @param label command label + * @param ref_operation reference to command to the previous set server status operation. + * @param index index to know which web server we check. + * @param expected_url url of the webhook + * @param expected_method method of the webhook + * @param expected_header header of the webhook + * @param expected_body body of the webhook + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_checkserver2 (const char *label, + const char *ref_operation, + unsigned int index, + const char *expected_url, + const char *expected_method, + const char *expected_header, + const char *expected_body); + /* ****** Specific traits supported by this component ******* */ diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 7caaa7ea..e04b6c7f 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -221,6 +221,7 @@ EXTRA_DIST = \ test_key_rotation.sh \ test_key_rotation.conf \ test_kyc_api.conf \ + test_merchant_api.conf \ test_merchant_api-cs.conf \ test_merchant_api-rsa.conf \ test_merchant_api_twisted-cs.conf \ diff --git a/src/testing/test.conf b/src/testing/test.conf index 502d807a..1444f799 100644 --- a/src/testing/test.conf +++ b/src/testing/test.conf @@ -18,6 +18,7 @@ TALER_CACHE_HOME = $TALER_HOME/.cache/taler/ # What currency do we use? CURRENCY = EUR CURRENCY_ROUND_UNIT = EUR:0.01 +AML_THRESHOLD = EUR:1000000 [taler-helper-crypto-rsa] # Reduce from 1 year to speed up test diff --git a/src/testing/test_merchant_api-cs.conf b/src/testing/test_merchant_api-cs.conf index 1444f799..4d1c14b6 100644 --- a/src/testing/test_merchant_api-cs.conf +++ b/src/testing/test_merchant_api-cs.conf @@ -1,128 +1,5 @@ # This file is in the public domain. -# -[PATHS] -# Persistent data storage for the testcase -TALER_TEST_HOME = test_merchant_api_home/ -TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/taler-system-runtime/ - -# Persistent data storage -TALER_DATA_HOME = $TALER_HOME/.local/share/taler/ - -# Configuration files -TALER_CONFIG_HOME = $TALER_HOME/.config/taler/ - -# Cached data, no big deal if lost -TALER_CACHE_HOME = $TALER_HOME/.cache/taler/ - -[taler] -# What currency do we use? -CURRENCY = EUR -CURRENCY_ROUND_UNIT = EUR:0.01 -AML_THRESHOLD = EUR:1000000 - -[taler-helper-crypto-rsa] -# Reduce from 1 year to speed up test -LOOKAHEAD_SIGN = 24 days - -[taler-helper-crypto-eddsa] -# Reduce from 1 year to speed up test -LOOKAHEAD_SIGN = 24 days -# Reduce from 12 weeks to ensure we have multiple -DURATION = 14 days - -[bank] -HTTP_PORT = 8082 - -########################################## -# Configuration for the merchant backend # -########################################## - -[merchant] - -# Which port do we run the backend on? (HTTP server) -PORT = 8080 - -# Which plugin (backend) do we use for the DB. -DB = postgres - -# This specifies which database the postgres backend uses. -[merchantdb-postgres] -CONFIG = postgres:///talercheck - -# Sections starting with "merchant-exchange-" specify trusted exchanges -# (by the merchant) -[merchant-exchange-test] -MASTER_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG -EXCHANGE_BASE_URL = http://localhost:8081/ -CURRENCY = EUR - - -####################################################### -# Configuration for the auditor for the testcase -####################################################### -[auditor] -BASE_URL = http://the.auditor/ - - -####################################################### -# Configuration for ??? Is this used? -####################################################### - -# Auditors must be in sections "auditor-", the rest of the section -# name could be anything. -[auditor-ezb] -# Informal name of the auditor. Just for the user. -NAME = European Central Bank - -# URL of the auditor (especially for in the future, when the -# auditor offers an automated issue reporting system). -# Not really used today. -URL = http://taler.ezb.eu/ - -# This is the important bit: the signing key of the auditor. -PUBLIC_KEY = 9QXF7XY7E9VPV47B5Z806NDFSX2VJ79SVHHD29QEQ3BG31ANHZ60 - -# Which currency is this auditor trusted for? -CURRENCY = EUR - - -################################################### -# Configuration for the exchange for the testcase # -################################################### - -[exchange] -# How to access our database -DB = postgres - -# HTTP port the exchange listens to -PORT = 8081 - -# Our public key -MASTER_PUBLIC_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG - -# Base URL of the exchange. -BASE_URL = "http://localhost:8081/" - - -[exchangedb-postgres] -CONFIG = "postgres:///talercheck" - - -[auditordb-postgres] -CONFIG = postgres:///talercheck - - -# Account of the EXCHANGE -[exchange-account-exchange] -# What is the exchange's bank account (with the "Taler Bank" demo system)? -PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" -ENABLE_DEBIT = YES -ENABLE_CREDIT = YES - -[exchange-accountcredentials-exchange] -WIRE_GATEWAY_URL = "http://localhost:8082/2/" -WIRE_GATEWAY_AUTH_METHOD = NONE - +@INLINE@ test_merchant_api.conf [coin_eur_ct_1] value = EUR:0.01 diff --git a/src/testing/test_merchant_api-rsa.conf b/src/testing/test_merchant_api-rsa.conf index 53d470c1..44d8e978 100644 --- a/src/testing/test_merchant_api-rsa.conf +++ b/src/testing/test_merchant_api-rsa.conf @@ -1,128 +1,5 @@ # This file is in the public domain. -# -[PATHS] -# Persistent data storage for the testcase -TALER_TEST_HOME = test_merchant_api_home/ -TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/taler-system-runtime/ - -# Persistent data storage -TALER_DATA_HOME = $TALER_HOME/.local/share/taler/ - -# Configuration files -TALER_CONFIG_HOME = $TALER_HOME/.config/taler/ - -# Cached data, no big deal if lost -TALER_CACHE_HOME = $TALER_HOME/.cache/taler/ - -[taler] -# What currency do we use? -CURRENCY = EUR -CURRENCY_ROUND_UNIT = EUR:0.01 -AML_THRESHOLD = EUR:1000000 - -[taler-helper-crypto-rsa] -# Reduce from 1 year to speed up test -LOOKAHEAD_SIGN = 24 days - -[taler-helper-crypto-eddsa] -# Reduce from 1 year to speed up test -LOOKAHEAD_SIGN = 24 days -# Reduce from 12 weeks to ensure we have multiple -DURATION = 14 days - -[bank] -HTTP_PORT = 8082 - -########################################## -# Configuration for the merchant backend # -########################################## - -[merchant] - -# Which port do we run the backend on? (HTTP server) -PORT = 8080 - -# Which plugin (backend) do we use for the DB. -DB = postgres - -# This specifies which database the postgres backend uses. -[merchantdb-postgres] -CONFIG = postgres:///talercheck - -# Sections starting with "merchant-exchange-" specify trusted exchanges -# (by the merchant) -[merchant-exchange-test] -MASTER_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG -EXCHANGE_BASE_URL = http://localhost:8081/ -CURRENCY = EUR - - -####################################################### -# Configuration for the auditor for the testcase -####################################################### -[auditor] -BASE_URL = http://the.auditor/ - - -####################################################### -# Configuration for ??? Is this used? -####################################################### - -# Auditors must be in sections "auditor-", the rest of the section -# name could be anything. -[auditor-ezb] -# Informal name of the auditor. Just for the user. -NAME = European Central Bank - -# URL of the auditor (especially for in the future, when the -# auditor offers an automated issue reporting system). -# Not really used today. -URL = http://taler.ezb.eu/ - -# This is the important bit: the signing key of the auditor. -PUBLIC_KEY = 9QXF7XY7E9VPV47B5Z806NDFSX2VJ79SVHHD29QEQ3BG31ANHZ60 - -# Which currency is this auditor trusted for? -CURRENCY = EUR - - -################################################### -# Configuration for the exchange for the testcase # -################################################### - -[exchange] -# How to access our database -DB = postgres - -# HTTP port the exchange listens to -PORT = 8081 - -# Our public key -MASTER_PUBLIC_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG - -# Base URL of the exchange. -BASE_URL = "http://localhost:8081/" - - -[exchangedb-postgres] -CONFIG = "postgres:///talercheck" - - -[auditordb-postgres] -CONFIG = postgres:///talercheck - - -# Account of the EXCHANGE -[exchange-account-exchange] -# What is the exchange's bank account (with the "Taler Bank" demo system)? -PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" -ENABLE_DEBIT = YES -ENABLE_CREDIT = YES - -[exchange-accountcredentials-exchange] -WIRE_GATEWAY_URL = "http://localhost:8082/2/" -WIRE_GATEWAY_AUTH_METHOD = NONE - +@INLINE@ test_merchant_api.conf [coin_eur_ct_1] value = EUR:0.01 diff --git a/src/testing/test_merchant_api.conf b/src/testing/test_merchant_api.conf new file mode 100644 index 00000000..e0451124 --- /dev/null +++ b/src/testing/test_merchant_api.conf @@ -0,0 +1,124 @@ +# This file is in the public domain. +# +[PATHS] +# Persistent data storage for the testcase +TALER_TEST_HOME = test_merchant_api_home/ +TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/taler-system-runtime/ + +# Persistent data storage +TALER_DATA_HOME = $TALER_HOME/.local/share/taler/ + +# Configuration files +TALER_CONFIG_HOME = $TALER_HOME/.config/taler/ + +# Cached data, no big deal if lost +TALER_CACHE_HOME = $TALER_HOME/.cache/taler/ + +[taler] +# What currency do we use? +CURRENCY = EUR +CURRENCY_ROUND_UNIT = EUR:0.01 +AML_THRESHOLD = EUR:1000000 + +[taler-helper-crypto-rsa] +# Reduce from 1 year to speed up test +LOOKAHEAD_SIGN = 24 days + +[taler-helper-crypto-eddsa] +# Reduce from 1 year to speed up test +LOOKAHEAD_SIGN = 24 days +# Reduce from 12 weeks to ensure we have multiple +DURATION = 14 days + +[bank] +HTTP_PORT = 8082 + +########################################## +# Configuration for the merchant backend # +########################################## + +[merchant] + +# Which port do we run the backend on? (HTTP server) +PORT = 8080 + +# Which plugin (backend) do we use for the DB. +DB = postgres + +# This specifies which database the postgres backend uses. +[merchantdb-postgres] +CONFIG = postgres:///talercheck + +# Sections starting with "merchant-exchange-" specify trusted exchanges +# (by the merchant) +[merchant-exchange-test] +MASTER_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG +EXCHANGE_BASE_URL = http://localhost:8081/ +CURRENCY = EUR + + +####################################################### +# Configuration for the auditor for the testcase +####################################################### +[auditor] +BASE_URL = http://the.auditor/ + + +####################################################### +# Configuration for ??? Is this used? +####################################################### + +# Auditors must be in sections "auditor-", the rest of the section +# name could be anything. +[auditor-ezb] +# Informal name of the auditor. Just for the user. +NAME = European Central Bank + +# URL of the auditor (especially for in the future, when the +# auditor offers an automated issue reporting system). +# Not really used today. +URL = http://taler.ezb.eu/ + +# This is the important bit: the signing key of the auditor. +PUBLIC_KEY = 9QXF7XY7E9VPV47B5Z806NDFSX2VJ79SVHHD29QEQ3BG31ANHZ60 + +# Which currency is this auditor trusted for? +CURRENCY = EUR + + +################################################### +# Configuration for the exchange for the testcase # +################################################### + +[exchange] +# How to access our database +DB = postgres + +# HTTP port the exchange listens to +PORT = 8081 + +# Our public key +MASTER_PUBLIC_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG + +# Base URL of the exchange. +BASE_URL = "http://localhost:8081/" + + +[exchangedb-postgres] +CONFIG = "postgres:///talercheck" + + +[auditordb-postgres] +CONFIG = postgres:///talercheck + + +# Account of the EXCHANGE +[exchange-account-exchange] +# What is the exchange's bank account (with the "Taler Bank" demo system)? +PAYTO_URI = "payto://x-taler-bank/localhost/2?receiver-name=2" +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +[exchange-accountcredentials-exchange] +WIRE_GATEWAY_URL = "http://localhost:8082/2/" +WIRE_GATEWAY_AUTH_METHOD = NONE diff --git a/src/testing/test_template.conf b/src/testing/test_template.conf index 21bb6186..4fc0a2c3 100644 --- a/src/testing/test_template.conf +++ b/src/testing/test_template.conf @@ -8,6 +8,7 @@ TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/taler-system-runtime/ [taler] CURRENCY = TESTKUDOS CURRENCY_ROUND_UNIT = TESTKUDOS:0.01 +AML_THRESHOLD = EUR:1000000 [exchange] MAX_KEYS_CACHING = forever diff --git a/src/testing/testing_api_cmd_checkserver.c b/src/testing/testing_api_cmd_checkserver.c index 1414bd1d..55f0b50d 100644 --- a/src/testing/testing_api_cmd_checkserver.c +++ b/src/testing/testing_api_cmd_checkserver.c @@ -33,7 +33,7 @@ /** - * State for a "check_aml_decision" CMD. + * State for a "checkserver" CMD. */ struct CheckState { @@ -60,22 +60,22 @@ struct CheckState /** * Expected method of the pending webhook. */ - char *expected_method; + const char *expected_method; /** * Expected url of the pending webhook. */ - char *expected_url; + const char *expected_url; /** * Expected header of the pending webhook. */ - char *expected_header; + const char *expected_header; /** * Expected body of the pending webhook. */ - char *expected_body; + const char *expected_body; }; @@ -93,56 +93,52 @@ checkserver_run (void *cls, { struct CheckState *cs = cls; const struct TALER_TESTING_Command *ref; + char **expected_url; + char **expected_http_method; + char **expected_header; + char **expected_body; + (void) cmd; cs->is = is; - ref = TALER_TESTING_interpreter_lookup_command (is, cs->ref_operation); - - if (NULL == ref) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "ref NULL\n"); + "ref NULL\n"); GNUNET_break (0); TALER_TESTING_interpreter_fail (is); return; } - - char **expected_url; if (GNUNET_OK != TALER_TESTING_get_trait_urls (ref, cs->index, &expected_url)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Trait url does not work\n"); - GNUNET_break (0); - TALER_TESTING_interpreter_fail (is); - return; - } + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Trait url does not work\n"); + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } if (NULL == *expected_url) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Trait for url is NULL!?\n"); - GNUNET_break (0); - TALER_TESTING_interpreter_fail (is); - return; - } - + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Trait for url is NULL!?\n"); + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } if (0 != strcmp (cs->expected_url, *expected_url)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "URL does not match: `%s' != `%s'\n", - cs->expected_url, - *expected_url); - TALER_TESTING_interpreter_fail (is); - return; - } - - char **expected_http_method; - + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "URL does not match: `%s' != `%s'\n", + cs->expected_url, + *expected_url); + TALER_TESTING_interpreter_fail (is); + return; + } if (GNUNET_OK != TALER_TESTING_get_trait_http_methods (ref, cs->index, @@ -150,16 +146,12 @@ checkserver_run (void *cls, TALER_TESTING_interpreter_fail (is); if (0 != strcmp (cs->expected_method, *expected_http_method)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "http_method does not match\n"); - TALER_TESTING_interpreter_fail (is); - return; - } - - - char **expected_header; - + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "http_method does not match\n"); + TALER_TESTING_interpreter_fail (is); + return; + } if (GNUNET_OK != TALER_TESTING_get_trait_http_header (ref, cs->index, @@ -170,17 +162,14 @@ checkserver_run (void *cls, ( (NULL != cs->expected_header) && (0 != strcmp (cs->expected_header, *expected_header)) ) ) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "header does not match: `%s' != `%s'\n", - cs->expected_header, - *expected_header); - TALER_TESTING_interpreter_fail (is); - return; - } - - char **expected_body; - + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "header does not match: `%s' != `%s'\n", + cs->expected_header, + *expected_header); + TALER_TESTING_interpreter_fail (is); + return; + } if (GNUNET_OK != TALER_TESTING_get_trait_http_body (ref, cs->index, @@ -191,38 +180,27 @@ checkserver_run (void *cls, ( (NULL != cs->expected_body) && (0 != strcmp (cs->expected_body, *expected_body) ) ) ) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "body does not match : `%s' and `%s'\n", - cs->expected_body, - *expected_body); - TALER_TESTING_interpreter_fail (is); - return; - } + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "body does not match : `%s' and `%s'\n", + cs->expected_body, + *expected_body); + TALER_TESTING_interpreter_fail (is); + return; + } TALER_TESTING_interpreter_next (is); } -/** - * This function is used to check the web server - * - * @param label command label - * @param ref_operation reference to command to the previous set server status operation. - * @param index index to know which web server we check. - * @param url of the webhook - * @param http_method of the webhook - * @param header of the webhook - * @param body of the webhook - */ struct TALER_TESTING_Command TALER_TESTING_cmd_checkserver2 (const char *label, const char *ref_operation, unsigned int index, - char *expected_url, - char *expected_method, - char *expected_header, - char *expected_body) + const char *expected_url, + const char *expected_method, + const char *expected_header, + const char *expected_body) { struct CheckState *cs; @@ -260,4 +238,5 @@ TALER_TESTING_cmd_checkserver (const char *label, "5.0 EUR"); } + /* end of testing_api_cmd_checkserver.c */ diff --git a/src/testing/testing_api_cmd_webhook.c b/src/testing/testing_api_cmd_webhook.c index e73f3502..8c5df5b9 100644 --- a/src/testing/testing_api_cmd_webhook.c +++ b/src/testing/testing_api_cmd_webhook.c @@ -118,9 +118,9 @@ webhook_cleanup (void *cls, */ static enum GNUNET_GenericReturnValue webhook_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) + const void **ret, + const char *trait, + unsigned int index) { struct WebhookState *ws = cls; struct TALER_TESTING_Trait traits[] = { @@ -135,13 +135,6 @@ webhook_traits (void *cls, } - -/** - * to use the 'taler-merchant-webhook' program. - * - * @param label command label. - * @param configuration file used by the webhook. - */ struct TALER_TESTING_Command TALER_TESTING_cmd_webhook (const char *label, const char *config_filename) |