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 2 : TALER_TESTING_cmd_sleep ("sleep",
68 : 6 /* seconds */),
69 2 : TALER_TESTING_cmd_get_exchange ("get-exchange-1",
70 2 : cred.cfg,
71 : "get-exchange",
72 : true,
73 : true),
74 2 : TALER_TESTING_cmd_get_exchange ("get-exchange-2",
75 2 : cred.cfg,
76 : "get-exchange-1",
77 : true,
78 : true),
79 2 : TALER_TESTING_cmd_end ()
80 : };
81 :
82 : (void) cls;
83 2 : TALER_TESTING_run (is,
84 : commands);
85 2 : }
86 :
87 :
88 : int
89 2 : main (int argc,
90 : char *const *argv)
91 : {
92 : (void) argc;
93 : {
94 : char *cipher;
95 :
96 2 : cipher = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
97 2 : GNUNET_assert (NULL != cipher);
98 2 : GNUNET_asprintf (&config_file,
99 : "test_exchange_api_keys_cherry_picking-%s.conf",
100 : cipher);
101 2 : GNUNET_free (cipher);
102 : }
103 2 : return TALER_TESTING_main (argv,
104 : "INFO",
105 : config_file,
106 : "exchange-account-2",
107 : TALER_TESTING_BS_FAKEBANK,
108 : &cred,
109 : &run,
110 : NULL);
111 : }
112 :
113 :
114 : /* end of test_exchange_api_keys_cherry_picking.c */
|