Project

General

Profile

0001-abtest-add-test16-for-AB_Banking_GetAccountSpecByAli.patch

rhabacker, 01/31/2020 08:09 PM

Download (2.6 KB)

View differences:

src/test/Makefile.am
8 8
endif
9 9

  
10 10
abtest_SOURCES=abtest.c
11
abtest_LDADD = $(aqbanking_internal_libs) $(gwenhywfar_libs)
11
abtest_LDADD = $(aqbanking_internal_libs) $(gwenhywfar_libs) -lgwengui-gtk2
12 12

  
13 13
imptest_SOURCES=imptest.c
14 14
imptest_LDADD = $(aqbanking_internal_libs) $(gwenhywfar_libs)
src/test/abtest.c
1089 1089
  return 0;
1090 1090
}
1091 1091

  
1092
#include <gwen-gui-gtk2/gtk2_gui.h>
1093
#include <aqbanking/gui/abgui.h>
1094

  
1095
int test16(int argc, char **argv)
1096
{
1097
  AB_BANKING *ab;
1098
  GWEN_GUI *gui;
1099
  AB_ACCOUNT_SPEC *ab_acc;
1100
  int rv;
1101
  int i;
1102
  int tries = 1;
1103

  
1104
  GWEN_Logger_SetLevel(AQBANKING_LOGDOMAIN, GWEN_LoggerLevel_Error);
1105

  
1106
  if (argc == 3)
1107
      tries = atoi(argv[2]);
1108

  
1109
  fprintf(stderr, "Creating AB_Banking...\n");
1110
  ab=AB_Banking_new("abtest", 0, 0);
1111

  
1112
  fprintf(stderr, "Initializing AB_Banking...\n");
1113
  rv=AB_Banking_Init(ab);
1114
  if (rv) {
1115
    fprintf(stderr, "Could not init AqBanking (%d)\n", rv);
1116
    return 2;
1117
  }
1118

  
1119
  gui = Gtk2_Gui_new();
1120
  GWEN_Gui_SetGui(gui);
1121
  AB_Gui_Extend(gui, ab);
1122

  
1123
  fprintf(stderr, "Fetching alias...\n");
1124
  for (i = 0; i < tries; i++) {
1125
    ab_acc = AB_Banking_GetAccountSpecByAlias(ab, "e6c8903a-85dc-4d6f-b489-7f7f1852067a-A000096");
1126
    if (tries == 1 && !ab_acc) {
1127
        fprintf(stderr, "Could not find alias\n");
1128
    }
1129
  }
1130
  fprintf(stderr, "Deinitializing AB_Banking...\n");
1131
  rv=AB_Banking_Fini(ab);
1132
  if (rv) {
1133
    fprintf(stderr, "Could not deinit AqBanking (%d)\n", rv);
1134
    return 2;
1135
  }
1136

  
1137
  fprintf(stderr, "Freeing AB_Banking...\n");
1138
  AB_Banking_free(ab);
1139

  
1140
  fprintf(stderr, "Finished\n");
1141
  return 0;
1142
}
1092 1143

  
1093 1144

  
1094 1145
int main(int argc, char **argv)
......
1129 1180
    rv=test13(argc, argv);
1130 1181
  else if (strcasecmp(cmd, "test15")==0)
1131 1182
    rv=test15(argc, argv);
1183
  else if (strcasecmp(cmd, "test16")==0)
1184
    rv=test16(argc, argv);
1132 1185
  else {
1133 1186
    fprintf(stderr, "Unknown command \"%s\"", cmd);
1134 1187
    rv=1;
1135
-