aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------doc/prebuilt0
-rw-r--r--src/bank-lib/test_bank_api.c60
-rw-r--r--src/bank-lib/test_bank_api_twisted.c34
3 files changed, 57 insertions, 37 deletions
diff --git a/doc/prebuilt b/doc/prebuilt
-Subproject ca53235ccfa0458ebf11c204888ca370e20ec3f
+Subproject 934a6a18301e81c4fd1b3a8cda2dc13dca4741c
diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c
index 1dd493bb0..bb62aead8 100644
--- a/src/bank-lib/test_bank_api.c
+++ b/src/bank-lib/test_bank_api.c
@@ -58,10 +58,15 @@ static char *payto_url;
static struct GNUNET_OS_Process *bankd;
/**
+ * Authentication data to use.
+ */
+static struct TALER_BANK_AuthenticationData auth;
+
+/**
* Flag indicating whether the test is running against the
* Fakebank. Set up at runtime.
*/
-static int WITH_FAKEBANK;
+static int with_fakebank;
/**
* Main function that will tell the interpreter what commands to
@@ -73,55 +78,62 @@ static void
run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
+ struct TALER_WireTransferIdentifierRawP wtid;
struct TALER_TESTING_Command commands[] = {
TALER_TESTING_cmd_bank_credits ("history-0",
account_url,
+ &auth,
NULL,
1),
- TALER_TESTING_cmd_fakebank_transfer ("debit-1",
- "KUDOS:5.01",
- account_url,
- payto_url,
- NULL,
- NULL),
+ TALER_TESTING_cmd_admin_add_incoming ("debit-1",
+ "KUDOS:5.01",
+ account_url,
+ &auth,
+ payto_url),
TALER_TESTING_cmd_bank_credits ("history-1c",
account_url,
+ &auth,
NULL,
5),
TALER_TESTING_cmd_bank_debits ("history-1d",
account_url,
+ &auth,
NULL,
5),
- TALER_TESTING_cmd_fakebank_transfer ("debit-2",
- "KUDOS:3.21",
- account_url,
- payto_url,
- NULL,
- NULL),
- TRANSFER ("credit-2",
- "KUDOS:3.22",
- TALER_TESTING_USER_ACCOUNT_NUMBER,
- TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER,
- "credit 2"),
+ TALER_TESTING_cmd_admin_add_incoming ("debit-2",
+ "KUDOS:3.21",
+ account_url,
+ &auth,
+ payto_url),
+ TALER_TESTING_cmd_transfer ("credit-2",
+ "KUDOS:3.22",
+ account_url,
+ &auth,
+ payto_url,
+ &wtid,
+ "http://exchange.example.com/"),
TALER_TESTING_cmd_bank_debits ("history-2b",
account_url,
+ &auth,
NULL,
5),
TALER_TESTING_cmd_end ()
};
+ memset (&wtid, 42, sizeof (wtid));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Bank serves at `%s'\n",
bank_url);
GNUNET_asprintf (&account_url,
"%s/%s",
- base_url,
+ bank_url,
"alice");
GNUNET_asprintf (&payto_url,
"payto://x-taler-bank/%s/%s",
- base_url,
+ bank_url,
"bob");
- if (GNUNET_YES == WITH_FAKEBANK)
+ // FIXME: init 'auth'!
+ if (GNUNET_YES == with_fakebank)
TALER_TESTING_run_with_fakebank (is,
commands,
bank_url);
@@ -144,9 +156,9 @@ main (int argc,
"DEBUG",
NULL);
- WITH_FAKEBANK = TALER_TESTING_has_in_name (argv[0],
+ with_fakebank = TALER_TESTING_has_in_name (argv[0],
"_with_fakebank");
- if (GNUNET_YES == WITH_FAKEBANK)
+ if (GNUNET_YES == with_fakebank)
{
TALER_LOG_DEBUG ("Running against the Fakebank.\n");
if (NULL == (bank_url = TALER_TESTING_prepare_fakebank (CONFIG_FILE,
@@ -178,7 +190,7 @@ main (int argc,
CONFIG_FILE,
NULL,
GNUNET_NO)) ? 0 : 1;
- if (GNUNET_NO == WITH_FAKEBANK)
+ if (GNUNET_NO == with_fakebank)
{
GNUNET_OS_process_kill (bankd,
diff --git a/src/bank-lib/test_bank_api_twisted.c b/src/bank-lib/test_bank_api_twisted.c
index b926f9655..ad8fd71d4 100644
--- a/src/bank-lib/test_bank_api_twisted.c
+++ b/src/bank-lib/test_bank_api_twisted.c
@@ -45,7 +45,7 @@
/**
* True when the test runs against Fakebank.
*/
-static int WITH_FAKEBANK;
+static int with_fakebank;
/**
* (real) Twister URL. Used at startup time to check if it runs.
@@ -53,10 +53,15 @@ static int WITH_FAKEBANK;
static char *twister_url;
/**
- * URL of the twister where all the connections to the
+ * Account URL of the twister where all the connections to the
* bank that have to be proxied should be addressed to.
*/
-#define TWISTED_BANK_URL twister_url
+static char *twisted_account_url;
+
+/**
+ * Authentication data to use.
+ */
+static struct TALER_BANK_AuthenticationData auth;
/**
* URL of the bank.
@@ -90,18 +95,21 @@ run (void *cls,
* fakebank runs inside the same process of the test.
*/
TALER_TESTING_cmd_wait_service ("wait-service",
- TWISTED_BANK_URL),
- TALER_TESTING_cmd_bank_history ("history-0",
- TWISTED_BANK_URL,
- TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER,
- TALER_BANK_DIRECTION_BOTH,
- GNUNET_NO,
+ twister_url),
+ TALER_TESTING_cmd_bank_credits ("history-0",
+ twisted_account_url,
+ &auth,
NULL,
5),
TALER_TESTING_cmd_end ()
};
- if (GNUNET_YES == WITH_FAKEBANK)
+ GNUNET_asprintf (&twisted_account_url,
+ "%s/%s",
+ twister_url,
+ "alice");
+ // FIXME: init 'auth'!
+ if (GNUNET_YES == with_fakebank)
TALER_TESTING_run_with_fakebank (is,
commands,
bank_url);
@@ -150,10 +158,10 @@ main (int argc,
return 77;
}
- WITH_FAKEBANK = TALER_TESTING_has_in_name (argv[0],
+ with_fakebank = TALER_TESTING_has_in_name (argv[0],
"_with_fakebank");
- if (GNUNET_YES == WITH_FAKEBANK)
+ if (GNUNET_YES == with_fakebank)
{
TALER_LOG_DEBUG ("Running against the Fakebank.\n");
if (NULL == (bank_url = TALER_TESTING_prepare_fakebank
@@ -193,7 +201,7 @@ main (int argc,
GNUNET_NO);
purge_process (twisterd);
- if (GNUNET_NO == WITH_FAKEBANK)
+ if (GNUNET_NO == with_fakebank)
{
GNUNET_OS_process_kill (bankd,
SIGKILL);