LCOV - code coverage report
Current view: top level - testing - test_exchange_api_keys_cherry_picking.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 24 24
Test Date: 2026-10-17 15:46:49 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /*
       2              :   This file is part of TALER
       3              :   Copyright (C) 2020 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 pub
       7              : lished
       8              :   by the Free Software Foundation; either version 3, or (at your
       9              :   option) any later version.
      10              : 
      11              :   TALER is distributed in the hope that it will be useful, but
      12              :   WITHOUT ANY WARRANTY; without even the implied warranty of
      13              :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14              :   GNU General Public License for more details.
      15              : 
      16              :   You should have received a copy of the GNU General Public
      17              :   License along with TALER; see the file COPYING.  If not, see
      18              :   <http://www.gnu.org/licenses/>
      19              : */
      20              : /**
      21              :  * @file testing/test_exchange_api_keys_cherry_picking.c
      22              :  * @brief testcase to test exchange's /keys cherry picking ability
      23              :  * @author Marcello Stanisci
      24              :  * @author Christian Grothoff
      25              :  */
      26              : #include "taler/taler_util.h"
      27              : #include "taler/taler_json_lib.h"
      28              : #include <gnunet/gnunet_util_lib.h>
      29              : #include <gnunet/gnunet_testing_lib.h>
      30              : #include <microhttpd.h>
      31              : #include "taler/taler_bank_service.h"
      32              : #include "taler/taler_testing_lib.h"
      33              : 
      34              : 
      35              : /**
      36              :  * Configuration file we use.  One (big) configuration is used
      37              :  * for the various components for this test.
      38              :  */
      39              : static char *config_file;
      40              : 
      41              : /**
      42              :  * Our credentials.
      43              :  */
      44              : static struct TALER_TESTING_Credentials cred;
      45              : 
      46              : 
      47              : /**
      48              :  * Main function that will tell the interpreter what commands to run.
      49              :  *
      50              :  * @param cls closure
      51              :  * @param is[in,out] interpreter state
      52              :  */
      53              : static void
      54            2 : run (void *cls,
      55              :      struct TALER_TESTING_Interpreter *is)
      56              : {
      57              :   struct TALER_TESTING_Command commands[] = {
      58            2 :     TALER_TESTING_cmd_system_start ("start-taler",
      59              :                                     config_file,
      60              :                                     "-e",
      61              :                                     NULL),
      62            2 :     TALER_TESTING_cmd_get_exchange ("get-exchange",
      63            2 :                                     cred.cfg,
      64              :                                     NULL,
      65              :                                     true,
      66              :                                     true),
      67              :     /* Denominations can be deposited for about 12 s after their start
      68              :        (see the -rsa/-cs configurations), so after this sleep the ones
      69              :        that were valid when we first downloaded /keys have expired,
      70              :        while those that started in the future are still valid. */
      71            2 :     TALER_TESTING_cmd_sleep ("sleep",
      72              :                              12 /* seconds */),
      73            2 :     TALER_TESTING_cmd_get_exchange ("get-exchange-1",
      74            2 :                                     cred.cfg,
      75              :                                     "get-exchange",
      76              :                                     true,
      77              :                                     true),
      78            2 :     TALER_TESTING_cmd_get_exchange ("get-exchange-1-full",
      79            2 :                                     cred.cfg,
      80              :                                     NULL,
      81              :                                     true,
      82              :                                     true),
      83            2 :     TALER_TESTING_cmd_check_keys ("check-keys-1",
      84              :                                   "get-exchange",
      85              :                                   "get-exchange-1",
      86              :                                   "get-exchange-1-full"),
      87            2 :     TALER_TESTING_cmd_get_exchange ("get-exchange-2",
      88            2 :                                     cred.cfg,
      89              :                                     "get-exchange-1",
      90              :                                     true,
      91              :                                     true),
      92            2 :     TALER_TESTING_cmd_get_exchange ("get-exchange-2-full",
      93            2 :                                     cred.cfg,
      94              :                                     NULL,
      95              :                                     true,
      96              :                                     true),
      97            2 :     TALER_TESTING_cmd_check_keys ("check-keys-2",
      98              :                                   "get-exchange-1",
      99              :                                   "get-exchange-2",
     100              :                                   "get-exchange-2-full"),
     101            2 :     TALER_TESTING_cmd_end ()
     102              :   };
     103              : 
     104              :   (void) cls;
     105            2 :   TALER_TESTING_run (is,
     106              :                      commands);
     107            2 : }
     108              : 
     109              : 
     110              : int
     111            2 : main (int argc,
     112              :       char *const *argv)
     113              : {
     114              :   (void) argc;
     115              :   {
     116              :     char *cipher;
     117              : 
     118            2 :     cipher = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
     119            2 :     GNUNET_assert (NULL != cipher);
     120            2 :     GNUNET_asprintf (&config_file,
     121              :                      "test_exchange_api_keys_cherry_picking-%s.conf",
     122              :                      cipher);
     123            2 :     GNUNET_free (cipher);
     124              :   }
     125            2 :   return TALER_TESTING_main (argv,
     126              :                              "INFO",
     127              :                              config_file,
     128              :                              "exchange-account-2",
     129              :                              TALER_TESTING_BS_FAKEBANK,
     130              :                              &cred,
     131              :                              &run,
     132              :                              NULL);
     133              : }
     134              : 
     135              : 
     136              : /* end of test_exchange_api_keys_cherry_picking.c */
        

Generated by: LCOV version 2.0-1