@@ -96,11 +96,12 @@ func init() {
96
96
97
97
func TestUserAuthentication (t * testing.T ) {
98
98
Convey ("Create Database" , t , func () {
99
- _ , db , c , err := connect (t , "" , "admin" , "admin" )
99
+ f , db , c , err := connect (t , "" , "admin" , "admin" )
100
100
So (db , ShouldNotBeNil )
101
101
So (c , ShouldNotBeNil )
102
102
So (err , ShouldBeNil )
103
103
defer db .Close ()
104
+ defer os .Remove (f )
104
105
105
106
b , err := authEnabled (db )
106
107
So (b , ShouldEqual , true )
@@ -121,6 +122,7 @@ func TestUserAuthentication(t *testing.T) {
121
122
So (db1 , ShouldNotBeNil )
122
123
So (c1 , ShouldNotBeNil )
123
124
So (err , ShouldBeNil )
125
+ defer os .Remove (f1 )
124
126
125
127
e , err := userExists (db1 , "admin" )
126
128
So (err , ShouldBeNil )
@@ -147,6 +149,7 @@ func TestUserAuthentication(t *testing.T) {
147
149
So (db1 , ShouldNotBeNil )
148
150
So (c1 , ShouldNotBeNil )
149
151
So (err , ShouldBeNil )
152
+ defer os .Remove (f1 )
150
153
defer db1 .Close ()
151
154
152
155
e , err := userExists (db1 , "admin" )
@@ -168,6 +171,7 @@ func TestUserAuthentication(t *testing.T) {
168
171
So (db1 , ShouldNotBeNil )
169
172
So (c1 , ShouldNotBeNil )
170
173
So (err , ShouldBeNil )
174
+ defer os .Remove (f1 )
171
175
172
176
e , err := userExists (db1 , "admin" )
173
177
So (err , ShouldBeNil )
@@ -176,6 +180,7 @@ func TestUserAuthentication(t *testing.T) {
176
180
a , err := isAdmin (db1 , "admin" )
177
181
So (err , ShouldBeNil )
178
182
So (a , ShouldEqual , true )
183
+ db1 .Close ()
179
184
180
185
// Perform Invalid Authentication when we connect
181
186
// to a database
@@ -193,6 +198,7 @@ func TestUserAuthentication(t *testing.T) {
193
198
So (db1 , ShouldNotBeNil )
194
199
So (c1 , ShouldNotBeNil )
195
200
So (err , ShouldBeNil )
201
+ defer os .Remove (f1 )
196
202
defer db1 .Close ()
197
203
198
204
e , err := userExists (db1 , "admin" )
@@ -213,10 +219,11 @@ func TestUserAuthentication(t *testing.T) {
213
219
214
220
func TestUserAuthenticationAddUser (t * testing.T ) {
215
221
Convey ("Add Admin User" , t , func () {
216
- _ , db , c , err := connect (t , "" , "admin" , "admin" )
222
+ f , db , c , err := connect (t , "" , "admin" , "admin" )
217
223
So (db , ShouldNotBeNil )
218
224
So (c , ShouldNotBeNil )
219
225
So (err , ShouldBeNil )
226
+ defer os .Remove (f )
220
227
defer db .Close ()
221
228
222
229
e , err := userExists (db , "admin" )
@@ -242,10 +249,11 @@ func TestUserAuthenticationAddUser(t *testing.T) {
242
249
})
243
250
244
251
Convey ("Add Admin User (*SQLiteConn)" , t , func () {
245
- _ , db , c , err := connect (t , "" , "admin" , "admin" )
252
+ f , db , c , err := connect (t , "" , "admin" , "admin" )
246
253
So (db , ShouldNotBeNil )
247
254
So (c , ShouldNotBeNil )
248
255
So (err , ShouldBeNil )
256
+ defer os .Remove (f )
249
257
defer db .Close ()
250
258
251
259
e , err := userExists (db , "admin" )
@@ -270,10 +278,11 @@ func TestUserAuthenticationAddUser(t *testing.T) {
270
278
})
271
279
272
280
Convey ("Add Normal User" , t , func () {
273
- _ , db , c , err := connect (t , "" , "admin" , "admin" )
281
+ f , db , c , err := connect (t , "" , "admin" , "admin" )
274
282
So (db , ShouldNotBeNil )
275
283
So (c , ShouldNotBeNil )
276
284
So (err , ShouldBeNil )
285
+ defer os .Remove (f )
277
286
defer db .Close ()
278
287
279
288
e , err := userExists (db , "admin" )
@@ -299,10 +308,11 @@ func TestUserAuthenticationAddUser(t *testing.T) {
299
308
})
300
309
301
310
Convey ("Add Normal User (*SQLiteConn)" , t , func () {
302
- _ , db , c , err := connect (t , "" , "admin" , "admin" )
311
+ f , db , c , err := connect (t , "" , "admin" , "admin" )
303
312
So (db , ShouldNotBeNil )
304
313
So (c , ShouldNotBeNil )
305
314
So (err , ShouldBeNil )
315
+ defer os .Remove (f )
306
316
defer db .Close ()
307
317
308
318
e , err := userExists (db , "admin" )
@@ -332,6 +342,7 @@ func TestUserAuthenticationAddUser(t *testing.T) {
332
342
So (db1 , ShouldNotBeNil )
333
343
So (c1 , ShouldNotBeNil )
334
344
So (err , ShouldBeNil )
345
+ defer os .Remove (f1 )
335
346
336
347
e , err := userExists (db1 , "admin" )
337
348
So (err , ShouldBeNil )
@@ -379,6 +390,7 @@ func TestUserAuthenticationAddUser(t *testing.T) {
379
390
So (db1 , ShouldNotBeNil )
380
391
So (c1 , ShouldNotBeNil )
381
392
So (err , ShouldBeNil )
393
+ defer os .Remove (f1 )
382
394
383
395
e , err := userExists (db1 , "admin" )
384
396
So (err , ShouldBeNil )
@@ -426,6 +438,7 @@ func TestUserAuthenticationAddUser(t *testing.T) {
426
438
So (db1 , ShouldNotBeNil )
427
439
So (c1 , ShouldNotBeNil )
428
440
So (err , ShouldBeNil )
441
+ defer os .Remove (f1 )
429
442
430
443
e , err := userExists (db1 , "admin" )
431
444
So (err , ShouldBeNil )
@@ -473,6 +486,7 @@ func TestUserAuthenticationAddUser(t *testing.T) {
473
486
So (db1 , ShouldNotBeNil )
474
487
So (c1 , ShouldNotBeNil )
475
488
So (err , ShouldBeNil )
489
+ defer os .Remove (f1 )
476
490
477
491
e , err := userExists (db1 , "admin" )
478
492
So (err , ShouldBeNil )
@@ -523,6 +537,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
523
537
So (db1 , ShouldNotBeNil )
524
538
So (c1 , ShouldNotBeNil )
525
539
So (err , ShouldBeNil )
540
+ defer os .Remove (f1 )
526
541
527
542
e , err := userExists (db1 , "admin" )
528
543
So (err , ShouldBeNil )
@@ -554,6 +569,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
554
569
So (db1 , ShouldNotBeNil )
555
570
So (c1 , ShouldNotBeNil )
556
571
So (err , ShouldBeNil )
572
+ defer os .Remove (f1 )
557
573
defer db1 .Close ()
558
574
559
575
e , err := userExists (db1 , "admin" )
@@ -584,6 +600,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
584
600
So (db1 , ShouldNotBeNil )
585
601
So (c1 , ShouldNotBeNil )
586
602
So (err , ShouldBeNil )
603
+ defer os .Remove (f1 )
587
604
defer db1 .Close ()
588
605
589
606
e , err := userExists (db1 , "admin" )
@@ -608,6 +625,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
608
625
So (db1 , ShouldNotBeNil )
609
626
So (c1 , ShouldNotBeNil )
610
627
So (err , ShouldBeNil )
628
+ defer os .Remove (f1 )
611
629
defer db1 .Close ()
612
630
613
631
e , err := userExists (db1 , "admin" )
@@ -632,6 +650,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
632
650
So (db1 , ShouldNotBeNil )
633
651
So (c1 , ShouldNotBeNil )
634
652
So (err , ShouldBeNil )
653
+ defer os .Remove (f1 )
635
654
636
655
e , err := userExists (db1 , "admin" )
637
656
So (err , ShouldBeNil )
@@ -677,6 +696,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
677
696
So (db1 , ShouldNotBeNil )
678
697
So (c1 , ShouldNotBeNil )
679
698
So (err , ShouldBeNil )
699
+ defer os .Remove (f1 )
680
700
681
701
e , err := userExists (db1 , "admin" )
682
702
So (err , ShouldBeNil )
@@ -713,6 +733,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
713
733
So (db1 , ShouldNotBeNil )
714
734
So (c1 , ShouldNotBeNil )
715
735
So (err , ShouldBeNil )
736
+ defer os .Remove (f1 )
716
737
717
738
e , err := userExists (db1 , "admin" )
718
739
So (err , ShouldBeNil )
@@ -760,6 +781,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
760
781
So (db1 , ShouldNotBeNil )
761
782
So (c1 , ShouldNotBeNil )
762
783
So (err , ShouldBeNil )
784
+ defer os .Remove (f1 )
763
785
764
786
e , err := userExists (db1 , "admin" )
765
787
So (err , ShouldBeNil )
@@ -796,6 +818,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
796
818
So (db1 , ShouldNotBeNil )
797
819
So (c1 , ShouldNotBeNil )
798
820
So (err , ShouldBeNil )
821
+ defer os .Remove (f1 )
799
822
800
823
e , err := userExists (db1 , "admin" )
801
824
So (err , ShouldBeNil )
@@ -858,6 +881,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
858
881
So (db1 , ShouldNotBeNil )
859
882
So (c1 , ShouldNotBeNil )
860
883
So (err , ShouldBeNil )
884
+ defer os .Remove (f1 )
861
885
862
886
e , err := userExists (db1 , "admin" )
863
887
So (err , ShouldBeNil )
@@ -923,6 +947,7 @@ func TestUserAuthenticationDeleteUser(t *testing.T) {
923
947
So (db1 , ShouldNotBeNil )
924
948
So (c1 , ShouldNotBeNil )
925
949
So (err , ShouldBeNil )
950
+ defer os .Remove (f1 )
926
951
927
952
e , err := userExists (db1 , "admin" )
928
953
So (err , ShouldBeNil )
@@ -961,6 +986,7 @@ func TestUserAuthenticationDeleteUser(t *testing.T) {
961
986
So (db1 , ShouldNotBeNil )
962
987
So (c1 , ShouldNotBeNil )
963
988
So (err , ShouldBeNil )
989
+ defer os .Remove (f1 )
964
990
965
991
e , err := userExists (db1 , "admin" )
966
992
So (err , ShouldBeNil )
@@ -998,6 +1024,7 @@ func TestUserAuthenticationDeleteUser(t *testing.T) {
998
1024
So (db1 , ShouldNotBeNil )
999
1025
So (c1 , ShouldNotBeNil )
1000
1026
So (err , ShouldBeNil )
1027
+ defer os .Remove (f1 )
1001
1028
1002
1029
e , err := userExists (db1 , "admin" )
1003
1030
So (err , ShouldBeNil )
@@ -1056,6 +1083,7 @@ func TestUserAuthenticationDeleteUser(t *testing.T) {
1056
1083
So (db1 , ShouldNotBeNil )
1057
1084
So (c1 , ShouldNotBeNil )
1058
1085
So (err , ShouldBeNil )
1086
+ defer os .Remove (f1 )
1059
1087
1060
1088
e , err := userExists (db1 , "admin" )
1061
1089
So (err , ShouldBeNil )
0 commit comments