@@ -25,6 +25,22 @@ var textBody = require("body");
25
25
var FinTSServer = require ( "../dev/FinTSServer.js" ) ;
26
26
var FinTSClient = require ( "../" ) ;
27
27
var should = require ( 'should' ) ;
28
+ var config = null ;
29
+ try {
30
+ config = require ( "./credentials.js" ) ;
31
+ } catch ( e ) {
32
+
33
+ }
34
+ var bunyan = require ( "bunyan" ) ;
35
+ var live = require ( "bunyan-live-logger" ) ;
36
+ var g_log = null ;
37
+
38
+ var logger = function ( n ) {
39
+ if ( g_log )
40
+ return g_log . child ( { testcase : n } ) ;
41
+ else
42
+ return null ;
43
+ } ;
28
44
29
45
var mocha_catcher = function ( done , cb ) {
30
46
return function ( ) {
@@ -79,12 +95,27 @@ describe('testserver',function(){
79
95
bankenliste [ '12345678' ] . url = "http://" + addr . address + ":" + addr . port + "/cgi-bin/hbciservlet" ;
80
96
myFINTSServer . my_url = bankenliste [ '12345678' ] . url ;
81
97
myFINTSServer . my_host = addr . address + ":" + addr . port ;
82
- done ( ) ;
98
+ // Logger
99
+ if ( config && config . bunyan_live_logger ) {
100
+ g_log = bunyan . createLogger ( {
101
+ name : 'testcases - withtestserver' ,
102
+ src :true ,
103
+ streams : [
104
+ {
105
+ level : 'trace' ,
106
+ stream : live ( { ready_cb :function ( ) { done ( ) ; } } ) ,
107
+ type :"raw"
108
+ }
109
+ ]
110
+ } ) ;
111
+ } else {
112
+ done ( ) ;
113
+ }
83
114
} ) ; ;
84
115
} ) ;
85
116
86
117
it ( 'Test 1 - MsgInitDialog' , function ( done ) {
87
- var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste ) ;
118
+ var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste , logger ( "Test 1" ) ) ;
88
119
var old_url = client . dest_url ;
89
120
client . MsgInitDialog ( mocha_catcher ( done , function ( error , recvMsg , has_neu_url ) {
90
121
if ( error )
@@ -100,7 +131,7 @@ describe('testserver',function(){
100
131
} ) ) ;
101
132
} ) ;
102
133
it ( 'Test 2 - MsgInitDialog wrong user' , function ( done ) {
103
- var client = new FinTSClient ( 12345678 , "test2" , "1234" , bankenliste ) ;
134
+ var client = new FinTSClient ( 12345678 , "test2" , "1234" , bankenliste , logger ( "Test 2" ) ) ;
104
135
var old_url = client . dest_url ;
105
136
client . MsgInitDialog ( mocha_catcher ( done , function ( error , recvMsg , has_neu_url ) {
106
137
if ( error ) {
@@ -111,7 +142,7 @@ describe('testserver',function(){
111
142
} ) ) ;
112
143
} ) ;
113
144
it ( 'Test 3 - MsgInitDialog wrong pin' , function ( done ) {
114
- var client = new FinTSClient ( 12345678 , "test1" , "12341" , bankenliste ) ;
145
+ var client = new FinTSClient ( 12345678 , "test1" , "12341" , bankenliste , logger ( "Test 3" ) ) ;
115
146
var old_url = client . dest_url ;
116
147
client . MsgInitDialog ( mocha_catcher ( done , function ( error , recvMsg , has_neu_url ) {
117
148
if ( error ) {
@@ -122,7 +153,7 @@ describe('testserver',function(){
122
153
} ) ) ;
123
154
} ) ;
124
155
it ( 'Test 4 - MsgEndDialog' , function ( done ) {
125
- var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste ) ;
156
+ var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste , logger ( "Test 4" ) ) ;
126
157
var old_url = client . dest_url ;
127
158
client . MsgInitDialog ( mocha_catcher ( done , function ( error , recvMsg , has_neu_url ) {
128
159
if ( error ) {
@@ -137,7 +168,7 @@ describe('testserver',function(){
137
168
} ) ) ;
138
169
} ) ;
139
170
it ( 'Test 5 - MsgRequestSepa' , function ( done ) {
140
- var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste ) ;
171
+ var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste , logger ( "Test 5" ) ) ;
141
172
client . MsgInitDialog ( mocha_catcher ( done , function ( error , recvMsg , has_neu_url ) {
142
173
if ( error ) {
143
174
throw error ;
@@ -161,7 +192,7 @@ describe('testserver',function(){
161
192
} ) ) ;
162
193
} ) ;
163
194
it ( 'Test 5.1 - MsgRequestSepa - failed connection' , function ( done ) {
164
- var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste ) ;
195
+ var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste , logger ( "Test 5.1" ) ) ;
165
196
client . MsgInitDialog ( mocha_catcher ( done , function ( error , recvMsg , has_neu_url ) {
166
197
if ( error ) {
167
198
throw error ;
@@ -183,7 +214,7 @@ describe('testserver',function(){
183
214
} ) ) ;
184
215
} ) ;
185
216
it ( 'Test 6 - EstablishConnection' , function ( done ) {
186
- var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste ) ;
217
+ var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste , logger ( "Test 6" ) ) ;
187
218
client . EstablishConnection ( mocha_catcher ( done , function ( error ) {
188
219
if ( error ) {
189
220
throw error ;
@@ -202,7 +233,7 @@ describe('testserver',function(){
202
233
} ) ) ;
203
234
} ) ;
204
235
it ( 'Test 7 - MsgGetKontoUmsaetze' , function ( done ) {
205
- var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste ) ;
236
+ var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste , logger ( "Test 7" ) ) ;
206
237
client . EstablishConnection ( mocha_catcher ( done , function ( error ) {
207
238
if ( error ) {
208
239
throw error ;
@@ -231,7 +262,7 @@ describe('testserver',function(){
231
262
myFINTSServer . hikas_2_mode = true ;
232
263
} ) ;
233
264
it ( 'Test 7.1 - MsgGetKontoUmsaetze - mit Aufsetzpunkt' , function ( done ) {
234
- var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste ) ;
265
+ var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste , logger ( "Test 7.1" ) ) ;
235
266
client . EstablishConnection ( mocha_catcher ( done , function ( error ) {
236
267
if ( error ) {
237
268
throw error ;
@@ -260,7 +291,7 @@ describe('testserver',function(){
260
291
} ) ;
261
292
} ) ;
262
293
it ( 'Test 8 - MsgGetSaldo' , function ( done ) {
263
- var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste ) ;
294
+ var client = new FinTSClient ( 12345678 , "test1" , "1234" , bankenliste , logger ( "Test 8" ) ) ;
264
295
client . EstablishConnection ( mocha_catcher ( done , function ( error ) {
265
296
if ( error ) {
266
297
throw error ;
0 commit comments