exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

test_exchange_api_overlapping_keys_bug.c (3503B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2018, 2019 Taler Systems SA
      4 
      5   TALER is free software; you can redistribute it and/or modify it
      6   under the terms of the GNU General Public License as published
      7   by the Free Software Foundation; either version 3, or (at your
      8   option) any later version.
      9 
     10   TALER is distributed in the hope that it will be useful, but
     11   WITHOUT ANY WARRANTY; without even the implied warranty of
     12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13   GNU General Public License for more details.
     14 
     15   You should have received a copy of the GNU General Public
     16   License along with TALER; see the file COPYING.  If not, see
     17   <http://www.gnu.org/licenses/>
     18 */
     19 
     20 /**
     21  * @file testing/test_exchange_api_overlapping_keys_bug.c
     22  * @brief testcase to test exchange's /keys cherry picking ability and
     23  *          other /keys related operations
     24  * @author Marcello Stanisci
     25  * @author Christian Grothoff
     26  */
     27 
     28 #include "taler/taler_util.h"
     29 #include "taler/taler_json_lib.h"
     30 #include <gnunet/gnunet_util_lib.h>
     31 #include <gnunet/gnunet_testing_lib.h>
     32 #include <microhttpd.h>
     33 #include "taler/taler_bank_service.h"
     34 #include "taler/taler_testing_lib.h"
     35 
     36 /**
     37  * Configuration file we use.  One (big) configuration is used
     38  * for the various components for this test.
     39  */
     40 static char *config_file;
     41 
     42 /**
     43  * Our credentials.
     44  */
     45 static struct TALER_TESTING_Credentials cred;
     46 
     47 
     48 /**
     49  * Main function that will tell the interpreter what commands to
     50  * run.
     51  *
     52  * @param cls closure
     53  */
     54 static void
     55 run (void *cls,
     56      struct TALER_TESTING_Interpreter *is)
     57 {
     58   struct TALER_TESTING_Command commands[] = {
     59     TALER_TESTING_cmd_run_fakebank ("run-fakebank",
     60                                     cred.cfg,
     61                                     "exchange-account-2"),
     62     TALER_TESTING_cmd_system_start ("start-taler",
     63                                     config_file,
     64                                     "-e",
     65                                     NULL),
     66     TALER_TESTING_cmd_get_exchange ("get-exchange",
     67                                     cred.cfg,
     68                                     NULL,
     69                                     true,
     70                                     true),
     71     TALER_TESTING_cmd_get_exchange ("get-exchange-1",
     72                                     cred.cfg,
     73                                     "get-exchange",
     74                                     true,
     75                                     true),
     76     TALER_TESTING_cmd_get_exchange ("get-exchange-2",
     77                                     cred.cfg,
     78                                     NULL,
     79                                     true,
     80                                     true),
     81     TALER_TESTING_cmd_end ()
     82   };
     83 
     84   (void) cls;
     85   TALER_TESTING_run (is,
     86                      commands);
     87 }
     88 
     89 
     90 int
     91 main (int argc,
     92       char *const *argv)
     93 {
     94   (void) argc;
     95   {
     96     char *cipher;
     97 
     98     cipher = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
     99     GNUNET_assert (NULL != cipher);
    100     GNUNET_asprintf (&config_file,
    101                      "test_exchange_api_keys_cherry_picking-%s.conf",
    102                      cipher);
    103     GNUNET_free (cipher);
    104   }
    105   return TALER_TESTING_main (argv,
    106                              "INFO",
    107                              config_file,
    108                              "exchange-account-2",
    109                              TALER_TESTING_BS_FAKEBANK,
    110                              &cred,
    111                              &run,
    112                              NULL);
    113 }
    114 
    115 
    116 /* end of test_exchange_api_overlapping_keys_bug.c */