aboutsummaryrefslogtreecommitdiff
path: root/src/bank-lib/testing_api_helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bank-lib/testing_api_helpers.c')
-rw-r--r--src/bank-lib/testing_api_helpers.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/bank-lib/testing_api_helpers.c b/src/bank-lib/testing_api_helpers.c
index db813df2a..a047c2a71 100644
--- a/src/bank-lib/testing_api_helpers.c
+++ b/src/bank-lib/testing_api_helpers.c
@@ -26,6 +26,7 @@
26#include "platform.h" 26#include "platform.h"
27#include <gnunet/gnunet_util_lib.h> 27#include <gnunet/gnunet_util_lib.h>
28#include "taler_testing_bank_lib.h" 28#include "taler_testing_bank_lib.h"
29#include "taler_fakebank_lib.h"
29 30
30/* Keep each bank account credentials at index: 31/* Keep each bank account credentials at index:
31 * bank account number - 1 */ 32 * bank account number - 1 */
@@ -47,6 +48,41 @@ struct TALER_BANK_AuthenticationData AUTHS[] = {
47 .details.basic.password = USER_PASSWORD } 48 .details.basic.password = USER_PASSWORD }
48}; 49};
49 50
51
52/**
53 * Runs the Fakebank by guessing / extracting the portnumber
54 * from the base URL.
55 *
56 * @param bank_url bank's base URL.
57 * @return the fakebank process handle, or NULL if any
58 * error occurs.
59 */
60struct TALER_FAKEBANK_Handle *
61TALER_TESTING_run_fakebank (const char *bank_url)
62{
63 const char *port;
64 long pnum;
65 struct TALER_FAKEBANK_Handle *fakebankd;
66
67 port = strrchr (bank_url,
68 (unsigned char) ':');
69 if (NULL == port)
70 pnum = 80;
71 else
72 pnum = strtol (port + 1, NULL, 10);
73 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
74 "Starting Fakebank on port %u (%s)\n",
75 (unsigned int) pnum,
76 bank_url);
77 fakebankd = TALER_FAKEBANK_start ((uint16_t) pnum);
78 if (NULL == fakebankd)
79 {
80 GNUNET_break (0);
81 return NULL;
82 }
83 return fakebankd;
84}
85
50/** 86/**
51 * Start the (Python) bank process. Assume the port 87 * Start the (Python) bank process. Assume the port
52 * is available and the database is clean. Use the "prepare 88 * is available and the database is clean. Use the "prepare