summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bank-lib/bank_api_common.c21
-rw-r--r--src/bank-lib/testing_api_helpers.c25
2 files changed, 31 insertions, 15 deletions
diff --git a/src/bank-lib/bank_api_common.c b/src/bank-lib/bank_api_common.c
index ec55db89..ad116007 100644
--- a/src/bank-lib/bank_api_common.c
+++ b/src/bank-lib/bank_api_common.c
@@ -59,11 +59,13 @@ append (struct curl_slist *hdr,
/**
* Build authentication header from @a auth.
*
- * @param auth authentication data to use
- * @return NULL on error, otherwise curl headers to use
+ * @param auth authentication data to use.
+ *
+ * @return NULL on error, otherwise curl headers to use.
*/
struct curl_slist *
-TALER_BANK_make_auth_header_ (const struct TALER_BANK_AuthenticationData *auth)
+TALER_BANK_make_auth_header_
+ (const struct TALER_BANK_AuthenticationData *auth)
{
struct curl_slist *authh;
@@ -89,9 +91,11 @@ TALER_BANK_make_auth_header_ (const struct TALER_BANK_AuthenticationData *auth)
/**
* Obtain the URL to use for an API request.
*
- * @param u base URL of the bank
- * @param path Taler API path (i.e. "/history")
- * @return the full URL to use with cURL
+ * @param u base URL of the bank.
+ * @param path Taler API path (i.e. "/history").
+ *
+ * @return the full URL to use with cURL, must be
+ * freed by the caller.
*/
char *
TALER_BANK_path_to_url_ (const char *u,
@@ -114,8 +118,9 @@ TALER_BANK_path_to_url_ (const char *u,
/**
* Parse error code given in @a json.
*
- * @param json the json to parse
- * @return error code, or #TALER_EC_INVALID if not found
+ * @param json the json to parse.
+ *
+ * @return error code, or #TALER_EC_INVALID if not found.
*/
enum TALER_ErrorCode
TALER_BANK_parse_ec_ (const json_t *json)
diff --git a/src/bank-lib/testing_api_helpers.c b/src/bank-lib/testing_api_helpers.c
index d890ea4e..cc6bf412 100644
--- a/src/bank-lib/testing_api_helpers.c
+++ b/src/bank-lib/testing_api_helpers.c
@@ -27,7 +27,8 @@
#include <gnunet/gnunet_util_lib.h>
#include "taler_testing_bank_lib.h"
-/* Keeps each bank account credential at bank account number - 1 */
+/* Keep each bank account credentials at index:
+ * bank account number - 1 */
struct TALER_BANK_AuthenticationData AUTHS[] = {
/* Bank credentials */
@@ -52,6 +53,8 @@ struct TALER_BANK_AuthenticationData AUTHS[] = {
* bank" function to do such tasks.
*
* @param config_filename configuration filename.
+ * @param bank_url base URL of the bank, used by `wget' to check
+ * that the bank was started right.
*
* @return the process, or NULL if the process could not
* be started.
@@ -60,10 +63,6 @@ struct GNUNET_OS_Process *
TALER_TESTING_run_bank (const char *config_filename,
const char *bank_url)
{
-
- /* to fetch: dbname+serving_method+base_url */
-
-
struct GNUNET_OS_Process *bank_proc;
unsigned int iter;
char *wget_cmd;
@@ -160,9 +159,10 @@ TALER_TESTING_run_bank (const char *config_filename,
}
+
/**
* Prepare the bank execution. Check if the port is available
- * (and reset database?).
+ * and reset database.
*
* @param config_filename configuration filename.
*
@@ -178,6 +178,7 @@ TALER_TESTING_prepare_bank (const char *config_filename)
enum GNUNET_OS_ProcessStatusType type;
unsigned long code;
char *base_url;
+ char *database;
cfg = GNUNET_CONFIGURATION_create ();
@@ -185,6 +186,16 @@ TALER_TESTING_prepare_bank (const char *config_filename)
(cfg, config_filename))
BANK_FAIL ();
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string
+ (cfg, "bank", "DATABASE", &database))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "bank",
+ "DATABASE");
+ GNUNET_CONFIGURATION_destroy (cfg);
+ BANK_FAIL ();
+ }
+
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number
(cfg, "bank", "HTTP_PORT", &port))
{
@@ -214,7 +225,7 @@ TALER_TESTING_prepare_bank (const char *config_filename)
"taler-bank-manage",
"taler-bank-manage",
"-c", "bank.conf",
- "--with-db=postgres:///talercheck", /*FIXME: no hardcoded*/
+ "--with-db", database, /*FIXME: no hardcoded*/
"django",
"flush",
"--no-input", NULL)))