gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] branch master updated (edf2455 -> 6bf006e)


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (edf2455 -> 6bf006e)
Date: Wed, 10 May 2017 15:52:31 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a change to branch master
in repository exchange.

    from edf2455  revert last change
     new 75f47e7  initial fixes to test exchange/bank interfacing
     new 7cbfdbd  uncommenting /admin/add/incoming interpreter command
     new e16d60b  fix field name
     new 2c43ff7  uncommenting the first failing bank-lib interpreter command
     new 6bf006e  removing use of bank's admin interface from bank-lib testcases

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/bank-lib/Makefile.am             |  3 +-
 src/bank-lib/bank_api_admin.c        |  5 ++--
 src/bank-lib/test_bank_api.c         | 55 ++++++++----------------------------
 src/bank-lib/test_bank_interpreter.c | 10 ++++---
 4 files changed, 23 insertions(+), 50 deletions(-)

diff --git a/src/bank-lib/Makefile.am b/src/bank-lib/Makefile.am
index 8d673f9..72c25f6 100644
--- a/src/bank-lib/Makefile.am
+++ b/src/bank-lib/Makefile.am
@@ -57,7 +57,8 @@ check_PROGRAMS = \
   test_bank_api_with_fakebank
 
 TESTS = \
-  test_bank_api_with_fakebank
+  test_bank_api
+#  test_bank_api_with_fakebank
 # For now, test_bank_api is known NOT to work (#5005, #4964, etc.)
 # $(check_PROGRAMS)
 
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c
index a243202..b57339f 100644
--- a/src/bank-lib/bank_api_admin.c
+++ b/src/bank-lib/bank_api_admin.c
@@ -88,7 +88,7 @@ handle_admin_add_incoming_finished (void *cls,
   case MHD_HTTP_OK:
     {
       struct GNUNET_JSON_Specification spec[] = {
-        GNUNET_JSON_spec_uint64 ("serial_id",
+        GNUNET_JSON_spec_uint64 ("row_id",
                                  &serial_id),
         GNUNET_JSON_spec_end()
       };
@@ -182,7 +182,8 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context 
*ctx,
     GNUNET_break (0);
     return NULL;
   }
-  admin_obj = json_pack ("{s:s, s:o, s:o, s:I, s:I}",
+  admin_obj = json_pack ("{s:{s:s}, s:s, s:o, s:o, s:I, s:I}",
+                         "auth", "type", "basic",
                          "exchange_url", exchange_base_url,
                          "wtid", GNUNET_JSON_from_data_auto (wtid),
                          "amount", TALER_JSON_from_amount (amount),
diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c
index 086a0af..4a37852 100644
--- a/src/bank-lib/test_bank_api.c
+++ b/src/bank-lib/test_bank_api.c
@@ -39,39 +39,45 @@ run (void *cls)
   int *resultp = cls;
   static struct TBI_Command commands[] =
   {
-    /* Add EUR:5.01 to account 42 */
+    /* Ask complete history of 'Exchange' user (number 2) */
     { .oc = TBI_OC_HISTORY,
       .label = "history-0",
-      .details.history.account_number = 1,
+      .details.history.account_number = 2,
       .details.history.direction = TALER_BANK_DIRECTION_BOTH,
       .details.history.start_row_ref = NULL,
       .details.history.num_results = 5 },
+    /* Move money from Exchange to Bank */
     { .oc = TBI_OC_ADMIN_ADD_INCOMING,
       .label = "deposit-1",
       .details.admin_add_incoming.exchange_base_url = "https://exchange.net/";, 
/* bogus */
       .details.admin_add_incoming.expected_response_code = MHD_HTTP_OK,
       .details.admin_add_incoming.credit_account_no = 1,
-      .details.admin_add_incoming.debit_account_no = 2,
+      .details.admin_add_incoming.debit_account_no = 2, /* Ignored */
       .details.admin_add_incoming.amount = "PUDOS:5.01" },
+    /* Move money from Exchange to Bank */
     { .oc = TBI_OC_ADMIN_ADD_INCOMING,
       .label = "deposit-2",
       .details.admin_add_incoming.exchange_base_url = "https://exchange.net/";, 
/* bogus */
       .details.admin_add_incoming.expected_response_code = MHD_HTTP_OK,
       .details.admin_add_incoming.credit_account_no = 1,
-      .details.admin_add_incoming.debit_account_no = 2,
+      .details.admin_add_incoming.debit_account_no = 2, /* Ignored */
       .details.admin_add_incoming.amount = "PUDOS:5.01" },
+    /* Ask Exchange's incoming history */
     { .oc = TBI_OC_HISTORY,
       .label = "history-1c",
-      .details.history.account_number = 1,
+      .details.history.account_number = 2,
       .details.history.direction = TALER_BANK_DIRECTION_CREDIT,
       .details.history.start_row_ref = NULL,
       .details.history.num_results = 5 },
+    /* Ask Exchange's outgoing history, 5 records into the future?? */
     { .oc = TBI_OC_HISTORY,
       .label = "history-2d",
       .details.history.account_number = 2,
       .details.history.direction = TALER_BANK_DIRECTION_DEBIT,
       .details.history.start_row_ref = NULL,
       .details.history.num_results = 5 },
+    # if 0
+    /* Ask Exchange's outgoing history, last 5 records */
     { .oc = TBI_OC_HISTORY,
       .label = "history-2dr",
       .details.history.account_number = 2,
@@ -84,6 +90,7 @@ run (void *cls)
       .details.history.direction = TALER_BANK_DIRECTION_DEBIT,
       .details.history.start_row_ref = "deposit-1",
       .details.history.num_results = 5 },
+  #endif
     { .oc = TBI_OC_END }
   };
 
@@ -104,7 +111,6 @@ main (int argc,
       char * const *argv)
 {
   struct GNUNET_OS_Process *bankd;
-  struct GNUNET_OS_Process *bankd_admin;
   unsigned int cnt;
   int result;
 
@@ -120,21 +126,6 @@ main (int argc,
   GNUNET_log_setup ("test-bank-api",
                     "WARNING",
                     NULL);
-  bankd_admin = GNUNET_OS_start_process (GNUNET_NO,
-                                         GNUNET_OS_INHERIT_STD_ALL,
-                                         NULL, NULL, NULL,
-                                         "taler-bank-manage",
-                                         "taler-bank-manage",
-                                         "--admin",
-                                         "serve-http",
-                                        "--port", "8081",
-                                         NULL);
-  if (NULL == bankd_admin)
-  {
-    fprintf (stderr,
-             "Failed to launch `taler-bank-manage' for admin, skipping 
test\n");
-    return 77; /* report 'skip' */
-  }
   bankd = GNUNET_OS_start_process (GNUNET_NO,
                                    GNUNET_OS_INHERIT_STD_ALL,
                                    NULL, NULL, NULL,
@@ -148,10 +139,6 @@ main (int argc,
   {
     fprintf (stderr,
              "Failed to launch taler-bank-manage, skipping test\n");
-    GNUNET_OS_process_kill (bankd_admin,
-                           SIGTERM);
-    GNUNET_OS_process_wait (bankd_admin);
-    GNUNET_OS_process_destroy (bankd_admin);
     return 77; /* report 'skip' */
   }
   /* give child time to start and bind against the socket */
@@ -168,20 +155,6 @@ main (int argc,
     }
   while (0 != system ("wget -q -t 1 -T 1 http://127.0.0.1:8080/ -o /dev/null 
-O /dev/null"));
 
-  do
-    {
-      fprintf (stderr, ",");
-      sleep (1);
-      cnt++;
-      if (cnt > 30)
-        break;
-      result = system ("wget -q -t 1 -T 1 
http://127.0.0.1:8081/admin/add/incoming -o /dev/null -O /dev/null");
-    }
-  while (! ( (WIFEXITED (result)) &&
-             (8 == WEXITSTATUS (result)) ) );
-  /* Note: we are using "GET", so /admin/add/incoming will yield a 405, which 
causes wget to return
-     a status code of 8. */
-
 
   fprintf (stderr, "\n");
   result = GNUNET_SYSERR;
@@ -193,12 +166,8 @@ main (int argc,
   }
   GNUNET_OS_process_kill (bankd,
                           SIGTERM);
-  GNUNET_OS_process_kill (bankd_admin,
-                          SIGTERM);
   GNUNET_OS_process_wait (bankd);
   GNUNET_OS_process_destroy (bankd);
-  GNUNET_OS_process_wait (bankd_admin);
-  GNUNET_OS_process_destroy (bankd_admin);
   if (cnt > 30)
   {
     fprintf (stderr,
diff --git a/src/bank-lib/test_bank_interpreter.c 
b/src/bank-lib/test_bank_interpreter.c
index 9603605..b1eb477 100644
--- a/src/bank-lib/test_bank_interpreter.c
+++ b/src/bank-lib/test_bank_interpreter.c
@@ -565,8 +565,8 @@ interpreter_run (void *cls)
     return;
   }
   auth.method = TALER_BANK_AUTH_BASIC; /* or "NONE"? */
-  auth.details.basic.username = "user";
-  auth.details.basic.password = "pass";
+  auth.details.basic.username = "Exchange";
+  auth.details.basic.password = "x";
   switch (cmd->oc)
   {
   case TBI_OC_END:
@@ -590,7 +590,7 @@ interpreter_run (void *cls)
                                 sizeof (cmd->details.admin_add_incoming.wtid));
     cmd->details.admin_add_incoming.aih
       = TALER_BANK_admin_add_incoming (is->ctx,
-                                       "http://localhost:8081";,
+                                       "http://localhost:8080";,
                                        &auth,
                                        
cmd->details.admin_add_incoming.exchange_base_url,
                                        &cmd->details.admin_add_incoming.wtid,
@@ -609,6 +609,8 @@ interpreter_run (void *cls)
   case TBI_OC_HISTORY:
     if (NULL != cmd->details.history.start_row_ref)
     {
+      /*In case history is to be found from some other commad's
+      output, like from /admin/add/incoming*/
       ref = find_command (is,
                           cmd->details.history.start_row_ref);
       GNUNET_assert (NULL != ref);
@@ -623,7 +625,7 @@ interpreter_run (void *cls)
       rowid = UINT64_MAX;
     cmd->details.history.hh
       = TALER_BANK_history (is->ctx,
-                            "http://localhost:8081";,
+                            "http://localhost:8080";,
                             &auth,
                             cmd->details.history.account_number,
                             cmd->details.history.direction,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]