test_exchange_api_keys_cherry_picking.c (3568B)
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/platform.h" 27 #include "taler/taler_util.h" 28 #include "taler/taler_signatures.h" 29 #include "taler/taler_exchange_service.h" 30 #include "taler/taler_json_lib.h" 31 #include <gnunet/gnunet_util_lib.h> 32 #include <gnunet/gnunet_testing_lib.h> 33 #include <microhttpd.h> 34 #include "taler/taler_bank_service.h" 35 #include "taler/taler_fakebank_lib.h" 36 #include "taler/taler_testing_lib.h" 37 38 39 /** 40 * Configuration file we use. One (big) configuration is used 41 * for the various components for this test. 42 */ 43 static char *config_file; 44 45 /** 46 * Our credentials. 47 */ 48 static struct TALER_TESTING_Credentials cred; 49 50 51 /** 52 * Main function that will tell the interpreter what commands to run. 53 * 54 * @param cls closure 55 * @param is[in,out] interpreter state 56 */ 57 static void 58 run (void *cls, 59 struct TALER_TESTING_Interpreter *is) 60 { 61 struct TALER_TESTING_Command commands[] = { 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_sleep ("sleep", 72 6 /* seconds */), 73 TALER_TESTING_cmd_get_exchange ("get-exchange-1", 74 cred.cfg, 75 "get-exchange", 76 true, 77 true), 78 TALER_TESTING_cmd_get_exchange ("get-exchange-2", 79 cred.cfg, 80 "get-exchange-1", 81 true, 82 true), 83 TALER_TESTING_cmd_end () 84 }; 85 86 (void) cls; 87 TALER_TESTING_run (is, 88 commands); 89 } 90 91 92 int 93 main (int argc, 94 char *const *argv) 95 { 96 (void) argc; 97 { 98 char *cipher; 99 100 cipher = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]); 101 GNUNET_assert (NULL != cipher); 102 GNUNET_asprintf (&config_file, 103 "test_exchange_api_keys_cherry_picking-%s.conf", 104 cipher); 105 GNUNET_free (cipher); 106 } 107 return TALER_TESTING_main (argv, 108 "INFO", 109 config_file, 110 "exchange-account-2", 111 TALER_TESTING_BS_FAKEBANK, 112 &cred, 113 &run, 114 NULL); 115 } 116 117 118 /* end of test_exchange_api_keys_cherry_picking.c */