test_wallet_lifecycle.c (1214B)
1 #include "taler_wallet_core_lib.h" 2 3 #include <stddef.h> 4 5 static void ignore_log(void *cls, 6 enum TALER_WALLET_LogLevel level, 7 const char *tag, 8 const char *msg) 9 { 10 (void) cls; 11 (void) level; 12 (void) tag; 13 (void) msg; 14 } 15 16 int main(void) 17 { 18 struct TALER_WALLET_Instance *first = TALER_WALLET_create(); 19 struct TALER_WALLET_Instance *second = TALER_WALLET_create(); 20 21 if (!first || !second) { 22 return 1; 23 } 24 if (TALER_WALLET_send_request(first, "{}") == 0) { 25 return 2; 26 } 27 28 TALER_WALLET_set_log_handler(first, ignore_log, NULL); 29 TALER_WALLET_set_log_handler(second, ignore_log, NULL); 30 TALER_set_curl_http_client(first); 31 TALER_set_curl_http_client(second); 32 33 if (TALER_WALLET_run(first) != 0 || TALER_WALLET_run(second) != 0) { 34 return 3; 35 } 36 if (TALER_WALLET_send_request(first, 37 "{\"id\":1,\"operation\":\"getVersion\",\"args\":{}}") != 0 || 38 TALER_WALLET_send_request(second, 39 "{\"id\":2,\"operation\":\"getVersion\",\"args\":{}}") != 0) { 40 return 4; 41 } 42 43 TALER_WALLET_destroy(first); 44 TALER_WALLET_destroy(second); 45 return 0; 46 }