Provide method to launch Fakebank withOUT running tests.
This commit is contained in:
parent
049e9c89c1
commit
cb6aab590b
@ -26,6 +26,7 @@
|
|||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
#include "taler_testing_bank_lib.h"
|
#include "taler_testing_bank_lib.h"
|
||||||
|
#include "taler_fakebank_lib.h"
|
||||||
|
|
||||||
/* Keep each bank account credentials at index:
|
/* Keep each bank account credentials at index:
|
||||||
* bank account number - 1 */
|
* bank account number - 1 */
|
||||||
@ -47,6 +48,41 @@ struct TALER_BANK_AuthenticationData AUTHS[] = {
|
|||||||
.details.basic.password = USER_PASSWORD }
|
.details.basic.password = USER_PASSWORD }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the Fakebank by guessing / extracting the portnumber
|
||||||
|
* from the base URL.
|
||||||
|
*
|
||||||
|
* @param bank_url bank's base URL.
|
||||||
|
* @return the fakebank process handle, or NULL if any
|
||||||
|
* error occurs.
|
||||||
|
*/
|
||||||
|
struct TALER_FAKEBANK_Handle *
|
||||||
|
TALER_TESTING_run_fakebank (const char *bank_url)
|
||||||
|
{
|
||||||
|
const char *port;
|
||||||
|
long pnum;
|
||||||
|
struct TALER_FAKEBANK_Handle *fakebankd;
|
||||||
|
|
||||||
|
port = strrchr (bank_url,
|
||||||
|
(unsigned char) ':');
|
||||||
|
if (NULL == port)
|
||||||
|
pnum = 80;
|
||||||
|
else
|
||||||
|
pnum = strtol (port + 1, NULL, 10);
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
"Starting Fakebank on port %u (%s)\n",
|
||||||
|
(unsigned int) pnum,
|
||||||
|
bank_url);
|
||||||
|
fakebankd = TALER_FAKEBANK_start ((uint16_t) pnum);
|
||||||
|
if (NULL == fakebankd)
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return fakebankd;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the (Python) bank process. Assume the port
|
* Start the (Python) bank process. Assume the port
|
||||||
* is available and the database is clean. Use the "prepare
|
* is available and the database is clean. Use the "prepare
|
||||||
|
@ -67,6 +67,17 @@ struct GNUNET_OS_Process *
|
|||||||
TALER_TESTING_run_bank (const char *config_filename,
|
TALER_TESTING_run_bank (const char *config_filename,
|
||||||
const char *bank_url);
|
const char *bank_url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the Fakebank by guessing / extracting the portnumber
|
||||||
|
* from the base URL.
|
||||||
|
*
|
||||||
|
* @param bank_url bank's base URL.
|
||||||
|
* @return the fakebank process handle, or NULL if any
|
||||||
|
* error occurs.
|
||||||
|
*/
|
||||||
|
struct TALER_FAKEBANK_Handle *
|
||||||
|
TALER_TESTING_run_fakebank (const char *bank_url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare the bank execution. Check if the port is available
|
* Prepare the bank execution. Check if the port is available
|
||||||
* and reset database.
|
* and reset database.
|
||||||
|
Loading…
Reference in New Issue
Block a user