aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2019-09-09 16:46:01 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2019-09-09 23:46:59 +0200
commitcb6aab590b93e619fd5ca1fd18f3dd1fcefd5696 (patch)
tree534297dfec88e9d2fb55ab7b15a6cfc47bd0120f
parent049e9c89c14f7701f46b5d7b71d54a06331774d3 (diff)
downloadexchange-cb6aab590b93e619fd5ca1fd18f3dd1fcefd5696.tar.gz
exchange-cb6aab590b93e619fd5ca1fd18f3dd1fcefd5696.zip
Provide method to launch Fakebank withOUT running tests.
-rw-r--r--src/bank-lib/testing_api_helpers.c36
-rw-r--r--src/include/taler_testing_bank_lib.h11
2 files changed, 47 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
diff --git a/src/include/taler_testing_bank_lib.h b/src/include/taler_testing_bank_lib.h
index 9948a7f2d..f72b804cd 100644
--- a/src/include/taler_testing_bank_lib.h
+++ b/src/include/taler_testing_bank_lib.h
@@ -68,6 +68,17 @@ TALER_TESTING_run_bank (const char *config_filename,
68 const char *bank_url); 68 const char *bank_url);
69 69
70/** 70/**
71 * Runs the Fakebank by guessing / extracting the portnumber
72 * from the base URL.
73 *
74 * @param bank_url bank's base URL.
75 * @return the fakebank process handle, or NULL if any
76 * error occurs.
77 */
78struct TALER_FAKEBANK_Handle *
79TALER_TESTING_run_fakebank (const char *bank_url);
80
81/**
71 * Prepare the bank execution. Check if the port is available 82 * Prepare the bank execution. Check if the port is available
72 * and reset database. 83 * and reset database.
73 * 84 *