Line data Source code
1 : /*
2 : This file is part of TALER
3 : Copyright (C) 2014-2020 Taler Systems SA
4 :
5 : TALER is free software; you can redistribute it and/or modify
6 : it under the terms of the GNU General Public License as
7 : published by the Free Software Foundation; either version 3, or
8 : (at your 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 : * @file testing/test_auditor_api.c
21 : * @brief testcase to test auditor's HTTP API interface
22 : * @author Christian Grothoff
23 : * @author Marcello Stanisci
24 : */
25 : #include "taler/taler_util.h"
26 : #include "taler/taler_signatures.h"
27 : #include "taler/taler_auditor_service.h"
28 : #include "taler/taler_json_lib.h"
29 : #include <gnunet/gnunet_util_lib.h>
30 : #include <gnunet/gnunet_testing_lib.h>
31 : #include <microhttpd.h>
32 : #include "taler/taler_bank_service.h"
33 : #include "taler/taler_testing_lib.h"
34 :
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 : static char *config_file_expire_reserve_now;
43 :
44 : /**
45 : * Our credentials.
46 : */
47 : static struct TALER_TESTING_Credentials cred;
48 :
49 : /**
50 : * Execute the taler-exchange-wirewatch command with
51 : * our configuration file.
52 : *
53 : * @param label label to use for the command.
54 : */
55 : #define CMD_EXEC_WIREWATCH(label) \
56 : TALER_TESTING_cmd_exec_wirewatch2 (label, config_file, \
57 : "exchange-account-2")
58 :
59 : /**
60 : * Execute the taler-exchange-aggregator, closer and transfer commands with
61 : * our configuration file.
62 : *
63 : * @param label label to use for the command.
64 : */
65 : #define CMD_EXEC_AGGREGATOR(label) \
66 : TALER_TESTING_cmd_sleep (label "-sleep", 1), \
67 : TALER_TESTING_cmd_exec_aggregator (label, config_file), \
68 : TALER_TESTING_cmd_exec_transfer (label, config_file)
69 :
70 : /**
71 : * Run wire transfer of funds from some user's account to the
72 : * exchange.
73 : *
74 : * @param label label to use for the command.
75 : * @param amount amount to transfer, i.e. "EUR:1"
76 : */
77 : #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \
78 : TALER_TESTING_cmd_admin_add_incoming (label, amount, \
79 : &cred.ba, \
80 : cred.user42_payto)
81 :
82 : /**
83 : * Run all auditor helpers and check that the auditor has no findings.
84 : *
85 : * @param label label to use for the command.
86 : */
87 : #define CMD_RUN_AUDITOR(label) \
88 : TALER_TESTING_cmd_exec_auditor (label, config_file)
89 :
90 :
91 : /**
92 : * Main function that will tell the interpreter what commands to
93 : * run.
94 : *
95 : * @param cls closure
96 : */
97 : static void
98 2 : run (void *cls,
99 : struct TALER_TESTING_Interpreter *is)
100 : {
101 : /**
102 : * Test withdraw.
103 : */
104 : struct TALER_TESTING_Command withdraw[] = {
105 : /**
106 : * Move money to the exchange's bank account.
107 : */
108 2 : CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1",
109 : "EUR:5.01"),
110 2 : TALER_TESTING_cmd_check_bank_admin_transfer
111 : ("check-create-reserve-1",
112 : "EUR:5.01", cred.user42_payto, cred.exchange_payto,
113 : "create-reserve-1"),
114 : /**
115 : * Make a reserve exist, according to the previous transfer.
116 : */
117 2 : CMD_EXEC_WIREWATCH ("wirewatch-1"),
118 : /**
119 : * Withdraw EUR:5.
120 : */
121 2 : TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1",
122 : "create-reserve-1",
123 : "EUR:5",
124 : 0, /* age restriction off */
125 : MHD_HTTP_OK),
126 2 : TALER_TESTING_cmd_end ()
127 : };
128 :
129 : struct TALER_TESTING_Command spend[] = {
130 : /**
131 : * Spend the coin.
132 : */
133 2 : TALER_TESTING_cmd_deposit ("deposit-simple",
134 : "withdraw-coin-1",
135 : 0,
136 : cred.user42_payto,
137 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
138 2 : GNUNET_TIME_UNIT_ZERO,
139 : "EUR:5",
140 : MHD_HTTP_OK),
141 2 : TALER_TESTING_cmd_end ()
142 : };
143 :
144 : struct TALER_TESTING_Command refresh[] = {
145 : /* Fill reserve with EUR:5, 1ct is for fees. NOTE: the old
146 : * test-suite gave a account number of _424_ to the user at
147 : * this step; to type less, here the _42_ number is reused.
148 : * Does this change the tests semantics? *///
149 2 : CMD_TRANSFER_TO_EXCHANGE ("refresh-create-reserve-1",
150 : "EUR:5.01"),
151 2 : TALER_TESTING_cmd_check_bank_admin_transfer
152 : ("check-refresh-create-reserve-1",
153 : "EUR:5.01", cred.user42_payto, cred.exchange_payto,
154 : "refresh-create-reserve-1"),
155 : /**
156 : * Make previous command effective.
157 : */
158 2 : CMD_EXEC_WIREWATCH ("wirewatch-2"),
159 : /**
160 : * Withdraw EUR:5.
161 : */
162 2 : TALER_TESTING_cmd_withdraw_amount ("refresh-withdraw-coin-1",
163 : "refresh-create-reserve-1",
164 : "EUR:5",
165 : 0, /* age restriction off */
166 : MHD_HTTP_OK),
167 : /**
168 : * Try to partially spend (deposit) 1 EUR of the 5 EUR coin (in
169 : * full) Merchant receives EUR:0.99 due to 1 ct deposit fee.
170 : */
171 2 : TALER_TESTING_cmd_deposit ("refresh-deposit-partial",
172 : "refresh-withdraw-coin-1",
173 : 0,
174 : cred.user42_payto,
175 : "{\"items\":[{\"name\":\"ice\",\"value\":\"EUR:1\"}]}",
176 2 : GNUNET_TIME_UNIT_ZERO,
177 : "EUR:1",
178 : MHD_HTTP_OK),
179 : /**
180 : * Melt the rest of the coin's value (EUR:4.00 = 3x EUR:1.03 + 7x
181 : * EUR:0.13)
182 : */
183 2 : TALER_TESTING_cmd_melt_double ("refresh-melt-1",
184 : "refresh-withdraw-coin-1",
185 : MHD_HTTP_OK,
186 : NULL),
187 : /**
188 : * Complete (successful) melt operation, and withdraw the coins
189 : */
190 2 : TALER_TESTING_cmd_melt_reveal ("refresh-reveal-1",
191 : "refresh-melt-1",
192 : MHD_HTTP_OK),
193 : /**
194 : * Try to spend a refreshed EUR:0.1 coin
195 : */
196 2 : TALER_TESTING_cmd_deposit ("refresh-deposit-refreshed-1b",
197 : "refresh-reveal-1",
198 : 3,
199 : cred.user43_payto,
200 : "{\"items\":[{\"name\":\"ice cream\",\"value\":3}]}",
201 2 : GNUNET_TIME_UNIT_ZERO,
202 : "EUR:0.1",
203 : MHD_HTTP_OK),
204 2 : TALER_TESTING_cmd_end ()
205 : };
206 :
207 : struct TALER_TESTING_Command track[] = {
208 : /**
209 : * Run transfers. Note that _actual_ aggregation will NOT
210 : * happen here, as each deposit operation is run with a
211 : * fresh merchant public key! NOTE: this comment comes
212 : * "verbatim" from the old test-suite, and IMO does not explain
213 : * a lot! */
214 2 : CMD_EXEC_AGGREGATOR ("run-aggregator"),
215 :
216 : /**
217 : * Check all the transfers took place.
218 : */
219 2 : TALER_TESTING_cmd_check_bank_transfer (
220 : "check_bank_transfer-499c",
221 2 : cred.exchange_url,
222 : "EUR:4.98",
223 : cred.exchange_payto,
224 : cred.user42_payto),
225 2 : TALER_TESTING_cmd_check_bank_transfer (
226 : "check_bank_transfer-99c1",
227 2 : cred.exchange_url,
228 : "EUR:0.98",
229 : cred.exchange_payto,
230 : cred.user42_payto),
231 2 : TALER_TESTING_cmd_check_bank_transfer (
232 : "check_bank_transfer-99c",
233 2 : cred.exchange_url,
234 : "EUR:0.08",
235 : cred.exchange_payto,
236 : cred.user43_payto),
237 :
238 : /* The following transactions got originated within
239 : * the "massive deposit confirms" batch. */
240 2 : TALER_TESTING_cmd_check_bank_transfer (
241 : "check-massive-transfer-1",
242 2 : cred.exchange_url,
243 : "EUR:0.98",
244 : cred.exchange_payto, cred.user43_payto),
245 2 : TALER_TESTING_cmd_check_bank_transfer
246 : ("check-massive-transfer-2",
247 2 : cred.exchange_url,
248 : "EUR:0.98",
249 : cred.exchange_payto, cred.user43_payto),
250 2 : TALER_TESTING_cmd_check_bank_transfer
251 : ("check-massive-transfer-3",
252 2 : cred.exchange_url,
253 : "EUR:0.98",
254 : cred.exchange_payto, cred.user43_payto),
255 2 : TALER_TESTING_cmd_check_bank_transfer
256 : ("check-massive-transfer-4",
257 2 : cred.exchange_url,
258 : "EUR:0.98",
259 : cred.exchange_payto, cred.user43_payto),
260 2 : TALER_TESTING_cmd_check_bank_transfer
261 : ("check-massive-transfer-5",
262 2 : cred.exchange_url,
263 : "EUR:0.98",
264 : cred.exchange_payto, cred.user43_payto),
265 2 : TALER_TESTING_cmd_check_bank_transfer
266 : ("check-massive-transfer-6",
267 2 : cred.exchange_url,
268 : "EUR:0.98",
269 : cred.exchange_payto, cred.user43_payto),
270 2 : TALER_TESTING_cmd_check_bank_transfer
271 : ("check-massive-transfer-7",
272 2 : cred.exchange_url,
273 : "EUR:0.98",
274 : cred.exchange_payto, cred.user43_payto),
275 2 : TALER_TESTING_cmd_check_bank_transfer
276 : ("check-massive-transfer-8",
277 2 : cred.exchange_url,
278 : "EUR:0.98",
279 : cred.exchange_payto, cred.user43_payto),
280 2 : TALER_TESTING_cmd_check_bank_transfer
281 : ("check-massive-transfer-9",
282 2 : cred.exchange_url,
283 : "EUR:0.98",
284 : cred.exchange_payto, cred.user43_payto),
285 2 : TALER_TESTING_cmd_check_bank_transfer
286 : ("check-massive-transfer-10",
287 2 : cred.exchange_url,
288 : "EUR:0.98",
289 : cred.exchange_payto, cred.user43_payto),
290 2 : TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"),
291 2 : TALER_TESTING_cmd_end ()
292 : };
293 :
294 : /**
295 : * This block checks whether a wire deadline
296 : * very far in the future does NOT get aggregated now.
297 : */
298 : struct TALER_TESTING_Command unaggregation[] = {
299 2 : TALER_TESTING_cmd_check_bank_empty ("far-future-aggregation-a"),
300 2 : CMD_TRANSFER_TO_EXCHANGE ("create-reserve-unaggregated",
301 : "EUR:5.01"),
302 2 : CMD_EXEC_WIREWATCH ("wirewatch-unaggregated"),
303 : /* "consume" reserve creation transfer. */
304 2 : TALER_TESTING_cmd_check_bank_admin_transfer (
305 : "check_bank_transfer-unaggregated",
306 : "EUR:5.01",
307 : cred.user42_payto,
308 : cred.exchange_payto,
309 : "create-reserve-unaggregated"),
310 2 : TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-unaggregated",
311 : "create-reserve-unaggregated",
312 : "EUR:5",
313 : 0, /* age restriction off */
314 : MHD_HTTP_OK),
315 2 : TALER_TESTING_cmd_deposit ("deposit-unaggregated",
316 : "withdraw-coin-unaggregated",
317 : 0,
318 : cred.user43_payto,
319 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
320 : GNUNET_TIME_relative_multiply
321 : (GNUNET_TIME_UNIT_YEARS,
322 : 3000),
323 : "EUR:5",
324 : MHD_HTTP_OK),
325 2 : CMD_EXEC_AGGREGATOR ("aggregation-attempt"),
326 2 : TALER_TESTING_cmd_check_bank_empty ("far-future-aggregation-b"),
327 2 : TALER_TESTING_cmd_end ()
328 : };
329 :
330 : struct TALER_TESTING_Command refund[] = {
331 : /**
332 : * Fill reserve with EUR:5.01, as withdraw fee is 1 ct per config.
333 : */
334 2 : CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1",
335 : "EUR:5.01"),
336 : /**
337 : * Run wire-watch to trigger the reserve creation.
338 : */
339 2 : CMD_EXEC_WIREWATCH ("wirewatch-3"),
340 : /**
341 : * Withdraw a 5 EUR coin, at fee of 1 ct
342 : */
343 2 : TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r1",
344 : "create-reserve-r1",
345 : "EUR:5",
346 : 0, /* age restriction off */
347 : MHD_HTTP_OK),
348 : /**
349 : * Spend 5 EUR of the 5 EUR coin (in full). Merchant would
350 : * receive EUR:4.99 due to 1 ct deposit fee.
351 : */
352 2 : TALER_TESTING_cmd_deposit ("deposit-refund-1",
353 : "withdraw-coin-r1",
354 : 0,
355 : cred.user42_payto,
356 : "{\"items\":[{\"name\":\"ice\",\"value\":\"EUR:5\"}]}",
357 : GNUNET_TIME_UNIT_MINUTES,
358 : "EUR:5",
359 : MHD_HTTP_OK),
360 :
361 2 : TALER_TESTING_cmd_refund ("refund-ok",
362 : MHD_HTTP_OK,
363 : "EUR:5",
364 : "deposit-refund-1"),
365 : /**
366 : * Spend 4.99 EUR of the refunded 4.99 EUR coin (1ct gone
367 : * due to refund) (merchant would receive EUR:4.98 due to
368 : * 1 ct deposit fee) */
369 2 : TALER_TESTING_cmd_deposit ("deposit-refund-2",
370 : "withdraw-coin-r1",
371 : 0,
372 : cred.user42_payto,
373 : "{\"items\":[{\"name\":\"more\",\"value\":\"EUR:5\"}]}",
374 2 : GNUNET_TIME_UNIT_ZERO,
375 : "EUR:4.99",
376 : MHD_HTTP_OK),
377 : /**
378 : * Run transfers. This will do the transfer as refund deadline was
379 : * 0.
380 : */
381 2 : CMD_EXEC_AGGREGATOR ("run-aggregator-3"),
382 2 : TALER_TESTING_cmd_end ()
383 : };
384 :
385 : struct TALER_TESTING_Command recoup[] = {
386 : /**
387 : * Fill reserve with EUR:5.01, as withdraw fee is 1 ct per
388 : * config.
389 : */
390 2 : CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-1",
391 : "EUR:5.01"),
392 : /**
393 : * Run wire-watch to trigger the reserve creation.
394 : */
395 2 : CMD_EXEC_WIREWATCH ("wirewatch-4"),
396 : /**
397 : * Withdraw a 5 EUR coin, at fee of 1 ct
398 : */
399 2 : TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-1",
400 : "recoup-create-reserve-1",
401 : "EUR:5",
402 : 0, /* age restriction off */
403 : MHD_HTTP_OK),
404 2 : TALER_TESTING_cmd_revoke ("revoke-1",
405 : MHD_HTTP_OK,
406 : "recoup-withdraw-coin-1",
407 : config_file),
408 2 : TALER_TESTING_cmd_recoup ("recoup-1",
409 : MHD_HTTP_OK,
410 : "recoup-withdraw-coin-1",
411 : "EUR:5"),
412 : /**
413 : * Re-withdraw from this reserve
414 : */
415 2 : TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2",
416 : "recoup-create-reserve-1",
417 : "EUR:1",
418 : 0, /* age restriction off */
419 : MHD_HTTP_OK),
420 : /**
421 : * These commands should close the reserve because the closer
422 : * is given a config file that overrides the reserve expiration
423 : * time (making it now-ish)
424 : */
425 2 : CMD_TRANSFER_TO_EXCHANGE ("short-lived-reserve",
426 : "EUR:5.01"),
427 2 : TALER_TESTING_cmd_exec_wirewatch2 ("short-lived-aggregation",
428 : config_file_expire_reserve_now,
429 : "exchange-account-2"),
430 2 : TALER_TESTING_cmd_exec_closer ("close-reserves",
431 : config_file_expire_reserve_now,
432 : "EUR:5",
433 : "EUR:0.01",
434 : "short-lived-reserve"),
435 2 : TALER_TESTING_cmd_exec_transfer ("close-reserves-transfer",
436 : config_file_expire_reserve_now),
437 : /**
438 : * Fill reserve with EUR:2.02, as withdraw fee is 1 ct per
439 : * config, then withdraw two coin, partially spend one, and
440 : * then have the rest paid back. Check deposit of other coin
441 : * fails. (Do not use EUR:5 here as the EUR:5 coin was
442 : * revoked and we did not bother to create a new one...)
443 2 : */CMD_TRANSFER_TO_EXCHANGE ("recoup-create-reserve-2",
444 : "EUR:2.02"),
445 : /**
446 : * Make previous command effective.
447 : */
448 2 : CMD_EXEC_WIREWATCH ("wirewatch-5"),
449 : /**
450 : * Withdraw a 1 EUR coin, at fee of 1 ct
451 : */
452 2 : TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2a",
453 : "recoup-create-reserve-2",
454 : "EUR:1",
455 : 0, /* age restriction off */
456 : MHD_HTTP_OK),
457 : /**
458 : * Withdraw a 1 EUR coin, at fee of 1 ct
459 : */
460 2 : TALER_TESTING_cmd_withdraw_amount ("recoup-withdraw-coin-2b",
461 : "recoup-create-reserve-2",
462 : "EUR:1",
463 : 0, /* age restriction off */
464 : MHD_HTTP_OK),
465 2 : TALER_TESTING_cmd_deposit ("recoup-deposit-partial",
466 : "recoup-withdraw-coin-2a",
467 : 0,
468 : cred.user42_payto,
469 : "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",
470 2 : GNUNET_TIME_UNIT_ZERO,
471 : "EUR:0.5",
472 : MHD_HTTP_OK),
473 2 : TALER_TESTING_cmd_revoke ("revoke-2",
474 : MHD_HTTP_OK,
475 : "recoup-withdraw-coin-2a",
476 : config_file),
477 2 : TALER_TESTING_cmd_recoup ("recoup-2",
478 : MHD_HTTP_OK,
479 : "recoup-withdraw-coin-2a",
480 : "EUR:0.5"),
481 2 : TALER_TESTING_cmd_end ()
482 : };
483 :
484 : struct TALER_TESTING_Command massive_deposit_confirms[] = {
485 :
486 : /**
487 : * Move money to the exchange's bank account.
488 : */
489 2 : CMD_TRANSFER_TO_EXCHANGE ("massive-reserve",
490 : "EUR:10.10"),
491 2 : TALER_TESTING_cmd_check_bank_admin_transfer (
492 : "check-massive-transfer",
493 : "EUR:10.10",
494 : cred.user42_payto,
495 : cred.exchange_payto,
496 : "massive-reserve"),
497 2 : CMD_EXEC_WIREWATCH ("massive-wirewatch"),
498 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-1",
499 : "massive-reserve",
500 : "EUR:1",
501 : 0, /* age restriction off */
502 : MHD_HTTP_OK),
503 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-2",
504 : "massive-reserve",
505 : "EUR:1",
506 : 0, /* age restriction off */
507 : MHD_HTTP_OK),
508 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-3",
509 : "massive-reserve",
510 : "EUR:1",
511 : 0, /* age restriction off */
512 : MHD_HTTP_OK),
513 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-4",
514 : "massive-reserve",
515 : "EUR:1",
516 : 0, /* age restriction off */
517 : MHD_HTTP_OK),
518 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-5",
519 : "massive-reserve",
520 : "EUR:1",
521 : 0, /* age restriction off */
522 : MHD_HTTP_OK),
523 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-6",
524 : "massive-reserve",
525 : "EUR:1",
526 : 0, /* age restriction off */
527 : MHD_HTTP_OK),
528 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-7",
529 : "massive-reserve",
530 : "EUR:1",
531 : 0, /* age restriction off */
532 : MHD_HTTP_OK),
533 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-8",
534 : "massive-reserve",
535 : "EUR:1",
536 : 0, /* age restriction off */
537 : MHD_HTTP_OK),
538 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-9",
539 : "massive-reserve",
540 : "EUR:1",
541 : 0, /* age restriction off */
542 : MHD_HTTP_OK),
543 2 : TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-10",
544 : "massive-reserve",
545 : "EUR:1",
546 : 0, /* age restriction off */
547 : MHD_HTTP_OK),
548 2 : TALER_TESTING_cmd_deposit (
549 : "massive-deposit-1",
550 : "massive-withdraw-1",
551 : 0,
552 : cred.user43_payto,
553 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
554 2 : GNUNET_TIME_UNIT_ZERO,
555 : "EUR:1",
556 : MHD_HTTP_OK),
557 2 : TALER_TESTING_cmd_deposit
558 : ("massive-deposit-2",
559 : "massive-withdraw-2",
560 : 0,
561 : cred.user43_payto,
562 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
563 2 : GNUNET_TIME_UNIT_ZERO,
564 : "EUR:1",
565 : MHD_HTTP_OK),
566 2 : TALER_TESTING_cmd_deposit
567 : ("massive-deposit-3",
568 : "massive-withdraw-3",
569 : 0,
570 : cred.user43_payto,
571 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
572 2 : GNUNET_TIME_UNIT_ZERO,
573 : "EUR:1",
574 : MHD_HTTP_OK),
575 2 : TALER_TESTING_cmd_deposit
576 : ("massive-deposit-4",
577 : "massive-withdraw-4",
578 : 0,
579 : cred.user43_payto,
580 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
581 2 : GNUNET_TIME_UNIT_ZERO,
582 : "EUR:1",
583 : MHD_HTTP_OK),
584 2 : TALER_TESTING_cmd_deposit
585 : ("massive-deposit-5",
586 : "massive-withdraw-5",
587 : 0,
588 : cred.user43_payto,
589 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
590 2 : GNUNET_TIME_UNIT_ZERO,
591 : "EUR:1",
592 : MHD_HTTP_OK),
593 2 : TALER_TESTING_cmd_deposit
594 : ("massive-deposit-6",
595 : "massive-withdraw-6",
596 : 0,
597 : cred.user43_payto,
598 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
599 2 : GNUNET_TIME_UNIT_ZERO,
600 : "EUR:1",
601 : MHD_HTTP_OK),
602 2 : TALER_TESTING_cmd_deposit
603 : ("massive-deposit-7",
604 : "massive-withdraw-7",
605 : 0,
606 : cred.user43_payto,
607 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
608 2 : GNUNET_TIME_UNIT_ZERO,
609 : "EUR:1",
610 : MHD_HTTP_OK),
611 2 : TALER_TESTING_cmd_deposit
612 : ("massive-deposit-8",
613 : "massive-withdraw-8",
614 : 0,
615 : cred.user43_payto,
616 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
617 2 : GNUNET_TIME_UNIT_ZERO,
618 : "EUR:1",
619 : MHD_HTTP_OK),
620 2 : TALER_TESTING_cmd_deposit
621 : ("massive-deposit-9",
622 : "massive-withdraw-9",
623 : 0,
624 : cred.user43_payto,
625 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
626 2 : GNUNET_TIME_UNIT_ZERO,
627 : "EUR:1",
628 : MHD_HTTP_OK),
629 2 : TALER_TESTING_cmd_deposit (
630 : "massive-deposit-10",
631 : "massive-withdraw-10",
632 : 0,
633 : cred.user43_payto,
634 : "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
635 2 : GNUNET_TIME_UNIT_ZERO,
636 : "EUR:1",
637 : MHD_HTTP_OK),
638 2 : TALER_TESTING_cmd_deposit_confirmation ("deposit-confirmation",
639 : "massive-deposit-10",
640 : 1,
641 : "EUR:0.99",
642 : MHD_HTTP_NO_CONTENT),
643 2 : CMD_RUN_AUDITOR ("massive-auditor"),
644 :
645 2 : TALER_TESTING_cmd_end ()
646 : };
647 :
648 : struct TALER_TESTING_Command commands[] = {
649 2 : TALER_TESTING_cmd_run_fakebank ("run-fakebank",
650 2 : cred.cfg,
651 : "exchange-account-2"),
652 2 : TALER_TESTING_cmd_system_start ("start-taler",
653 : config_file,
654 : "-u", "exchange-account-2",
655 : "-ea",
656 : NULL),
657 2 : TALER_TESTING_cmd_get_exchange ("get-exchange",
658 2 : cred.cfg,
659 : NULL,
660 : true,
661 : true),
662 2 : TALER_TESTING_cmd_get_auditor ("get-auditor",
663 2 : cred.cfg,
664 : true),
665 2 : TALER_TESTING_cmd_exec_auditor_offline ("auditor-offline",
666 : config_file),
667 2 : CMD_RUN_AUDITOR ("virgin-auditor"),
668 2 : TALER_TESTING_cmd_batch ("massive-deposit-confirms",
669 : massive_deposit_confirms),
670 2 : TALER_TESTING_cmd_batch ("withdraw",
671 : withdraw),
672 2 : TALER_TESTING_cmd_batch ("spend",
673 : spend),
674 2 : TALER_TESTING_cmd_batch ("refresh",
675 : refresh),
676 2 : TALER_TESTING_cmd_batch ("track",
677 : track),
678 2 : TALER_TESTING_cmd_batch ("unaggregation",
679 : unaggregation),
680 2 : TALER_TESTING_cmd_batch ("refund",
681 : refund),
682 2 : TALER_TESTING_cmd_batch ("recoup",
683 : recoup),
684 2 : CMD_RUN_AUDITOR ("normal-auditor"),
685 2 : TALER_TESTING_cmd_end ()
686 : };
687 :
688 : (void) cls;
689 2 : TALER_TESTING_run (is,
690 : commands);
691 2 : }
692 :
693 :
694 : int
695 2 : main (int argc,
696 : char *const *argv)
697 : {
698 : (void) argc;
699 : {
700 : char *cipher;
701 :
702 2 : cipher = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
703 2 : GNUNET_assert (NULL != cipher);
704 2 : GNUNET_asprintf (&config_file,
705 : "test_auditor_api-%s.conf",
706 : cipher);
707 2 : GNUNET_asprintf (&config_file_expire_reserve_now,
708 : "test_auditor_api_expire_reserve_now-%s.conf",
709 : cipher);
710 2 : GNUNET_free (cipher);
711 : }
712 2 : return TALER_TESTING_main (argv,
713 : "INFO",
714 : config_file,
715 : "exchange-account-2",
716 : TALER_TESTING_BS_FAKEBANK,
717 : &cred,
718 : &run,
719 : NULL);
720 : }
721 :
722 :
723 : /* end of test_auditor_api.c */
|