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