Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4ba9507

Browse files
Fix: test suite remove created files
1 parent 7337e65 commit 4ba9507

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

‎sqlite3_opt_userauth_test.go‎

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ func init() {
9696

9797
func TestUserAuthentication(t *testing.T) {
9898
Convey("Create Database", t, func() {
99-
_, db, c, err := connect(t, "", "admin", "admin")
99+
f, db, c, err := connect(t, "", "admin", "admin")
100100
So(db, ShouldNotBeNil)
101101
So(c, ShouldNotBeNil)
102102
So(err, ShouldBeNil)
103103
defer db.Close()
104+
defer os.Remove(f)
104105

105106
b, err := authEnabled(db)
106107
So(b, ShouldEqual, true)
@@ -121,6 +122,7 @@ func TestUserAuthentication(t *testing.T) {
121122
So(db1, ShouldNotBeNil)
122123
So(c1, ShouldNotBeNil)
123124
So(err, ShouldBeNil)
125+
defer os.Remove(f1)
124126

125127
e, err := userExists(db1, "admin")
126128
So(err, ShouldBeNil)
@@ -147,6 +149,7 @@ func TestUserAuthentication(t *testing.T) {
147149
So(db1, ShouldNotBeNil)
148150
So(c1, ShouldNotBeNil)
149151
So(err, ShouldBeNil)
152+
defer os.Remove(f1)
150153
defer db1.Close()
151154

152155
e, err := userExists(db1, "admin")
@@ -168,6 +171,7 @@ func TestUserAuthentication(t *testing.T) {
168171
So(db1, ShouldNotBeNil)
169172
So(c1, ShouldNotBeNil)
170173
So(err, ShouldBeNil)
174+
defer os.Remove(f1)
171175

172176
e, err := userExists(db1, "admin")
173177
So(err, ShouldBeNil)
@@ -176,6 +180,7 @@ func TestUserAuthentication(t *testing.T) {
176180
a, err := isAdmin(db1, "admin")
177181
So(err, ShouldBeNil)
178182
So(a, ShouldEqual, true)
183+
db1.Close()
179184

180185
// Perform Invalid Authentication when we connect
181186
// to a database
@@ -193,6 +198,7 @@ func TestUserAuthentication(t *testing.T) {
193198
So(db1, ShouldNotBeNil)
194199
So(c1, ShouldNotBeNil)
195200
So(err, ShouldBeNil)
201+
defer os.Remove(f1)
196202
defer db1.Close()
197203

198204
e, err := userExists(db1, "admin")
@@ -213,10 +219,11 @@ func TestUserAuthentication(t *testing.T) {
213219

214220
func TestUserAuthenticationAddUser(t *testing.T) {
215221
Convey("Add Admin User", t, func() {
216-
_, db, c, err := connect(t, "", "admin", "admin")
222+
f, db, c, err := connect(t, "", "admin", "admin")
217223
So(db, ShouldNotBeNil)
218224
So(c, ShouldNotBeNil)
219225
So(err, ShouldBeNil)
226+
defer os.Remove(f)
220227
defer db.Close()
221228

222229
e, err := userExists(db, "admin")
@@ -242,10 +249,11 @@ func TestUserAuthenticationAddUser(t *testing.T) {
242249
})
243250

244251
Convey("Add Admin User (*SQLiteConn)", t, func() {
245-
_, db, c, err := connect(t, "", "admin", "admin")
252+
f, db, c, err := connect(t, "", "admin", "admin")
246253
So(db, ShouldNotBeNil)
247254
So(c, ShouldNotBeNil)
248255
So(err, ShouldBeNil)
256+
defer os.Remove(f)
249257
defer db.Close()
250258

251259
e, err := userExists(db, "admin")
@@ -270,10 +278,11 @@ func TestUserAuthenticationAddUser(t *testing.T) {
270278
})
271279

272280
Convey("Add Normal User", t, func() {
273-
_, db, c, err := connect(t, "", "admin", "admin")
281+
f, db, c, err := connect(t, "", "admin", "admin")
274282
So(db, ShouldNotBeNil)
275283
So(c, ShouldNotBeNil)
276284
So(err, ShouldBeNil)
285+
defer os.Remove(f)
277286
defer db.Close()
278287

279288
e, err := userExists(db, "admin")
@@ -299,10 +308,11 @@ func TestUserAuthenticationAddUser(t *testing.T) {
299308
})
300309

301310
Convey("Add Normal User (*SQLiteConn)", t, func() {
302-
_, db, c, err := connect(t, "", "admin", "admin")
311+
f, db, c, err := connect(t, "", "admin", "admin")
303312
So(db, ShouldNotBeNil)
304313
So(c, ShouldNotBeNil)
305314
So(err, ShouldBeNil)
315+
defer os.Remove(f)
306316
defer db.Close()
307317

308318
e, err := userExists(db, "admin")
@@ -332,6 +342,7 @@ func TestUserAuthenticationAddUser(t *testing.T) {
332342
So(db1, ShouldNotBeNil)
333343
So(c1, ShouldNotBeNil)
334344
So(err, ShouldBeNil)
345+
defer os.Remove(f1)
335346

336347
e, err := userExists(db1, "admin")
337348
So(err, ShouldBeNil)
@@ -379,6 +390,7 @@ func TestUserAuthenticationAddUser(t *testing.T) {
379390
So(db1, ShouldNotBeNil)
380391
So(c1, ShouldNotBeNil)
381392
So(err, ShouldBeNil)
393+
defer os.Remove(f1)
382394

383395
e, err := userExists(db1, "admin")
384396
So(err, ShouldBeNil)
@@ -426,6 +438,7 @@ func TestUserAuthenticationAddUser(t *testing.T) {
426438
So(db1, ShouldNotBeNil)
427439
So(c1, ShouldNotBeNil)
428440
So(err, ShouldBeNil)
441+
defer os.Remove(f1)
429442

430443
e, err := userExists(db1, "admin")
431444
So(err, ShouldBeNil)
@@ -473,6 +486,7 @@ func TestUserAuthenticationAddUser(t *testing.T) {
473486
So(db1, ShouldNotBeNil)
474487
So(c1, ShouldNotBeNil)
475488
So(err, ShouldBeNil)
489+
defer os.Remove(f1)
476490

477491
e, err := userExists(db1, "admin")
478492
So(err, ShouldBeNil)
@@ -523,6 +537,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
523537
So(db1, ShouldNotBeNil)
524538
So(c1, ShouldNotBeNil)
525539
So(err, ShouldBeNil)
540+
defer os.Remove(f1)
526541

527542
e, err := userExists(db1, "admin")
528543
So(err, ShouldBeNil)
@@ -554,6 +569,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
554569
So(db1, ShouldNotBeNil)
555570
So(c1, ShouldNotBeNil)
556571
So(err, ShouldBeNil)
572+
defer os.Remove(f1)
557573
defer db1.Close()
558574

559575
e, err := userExists(db1, "admin")
@@ -584,6 +600,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
584600
So(db1, ShouldNotBeNil)
585601
So(c1, ShouldNotBeNil)
586602
So(err, ShouldBeNil)
603+
defer os.Remove(f1)
587604
defer db1.Close()
588605

589606
e, err := userExists(db1, "admin")
@@ -608,6 +625,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
608625
So(db1, ShouldNotBeNil)
609626
So(c1, ShouldNotBeNil)
610627
So(err, ShouldBeNil)
628+
defer os.Remove(f1)
611629
defer db1.Close()
612630

613631
e, err := userExists(db1, "admin")
@@ -632,6 +650,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
632650
So(db1, ShouldNotBeNil)
633651
So(c1, ShouldNotBeNil)
634652
So(err, ShouldBeNil)
653+
defer os.Remove(f1)
635654

636655
e, err := userExists(db1, "admin")
637656
So(err, ShouldBeNil)
@@ -677,6 +696,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
677696
So(db1, ShouldNotBeNil)
678697
So(c1, ShouldNotBeNil)
679698
So(err, ShouldBeNil)
699+
defer os.Remove(f1)
680700

681701
e, err := userExists(db1, "admin")
682702
So(err, ShouldBeNil)
@@ -713,6 +733,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
713733
So(db1, ShouldNotBeNil)
714734
So(c1, ShouldNotBeNil)
715735
So(err, ShouldBeNil)
736+
defer os.Remove(f1)
716737

717738
e, err := userExists(db1, "admin")
718739
So(err, ShouldBeNil)
@@ -760,6 +781,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
760781
So(db1, ShouldNotBeNil)
761782
So(c1, ShouldNotBeNil)
762783
So(err, ShouldBeNil)
784+
defer os.Remove(f1)
763785

764786
e, err := userExists(db1, "admin")
765787
So(err, ShouldBeNil)
@@ -796,6 +818,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
796818
So(db1, ShouldNotBeNil)
797819
So(c1, ShouldNotBeNil)
798820
So(err, ShouldBeNil)
821+
defer os.Remove(f1)
799822

800823
e, err := userExists(db1, "admin")
801824
So(err, ShouldBeNil)
@@ -858,6 +881,7 @@ func TestUserAuthenticationModifyUser(t *testing.T) {
858881
So(db1, ShouldNotBeNil)
859882
So(c1, ShouldNotBeNil)
860883
So(err, ShouldBeNil)
884+
defer os.Remove(f1)
861885

862886
e, err := userExists(db1, "admin")
863887
So(err, ShouldBeNil)
@@ -923,6 +947,7 @@ func TestUserAuthenticationDeleteUser(t *testing.T) {
923947
So(db1, ShouldNotBeNil)
924948
So(c1, ShouldNotBeNil)
925949
So(err, ShouldBeNil)
950+
defer os.Remove(f1)
926951

927952
e, err := userExists(db1, "admin")
928953
So(err, ShouldBeNil)
@@ -961,6 +986,7 @@ func TestUserAuthenticationDeleteUser(t *testing.T) {
961986
So(db1, ShouldNotBeNil)
962987
So(c1, ShouldNotBeNil)
963988
So(err, ShouldBeNil)
989+
defer os.Remove(f1)
964990

965991
e, err := userExists(db1, "admin")
966992
So(err, ShouldBeNil)
@@ -998,6 +1024,7 @@ func TestUserAuthenticationDeleteUser(t *testing.T) {
9981024
So(db1, ShouldNotBeNil)
9991025
So(c1, ShouldNotBeNil)
10001026
So(err, ShouldBeNil)
1027+
defer os.Remove(f1)
10011028

10021029
e, err := userExists(db1, "admin")
10031030
So(err, ShouldBeNil)
@@ -1056,6 +1083,7 @@ func TestUserAuthenticationDeleteUser(t *testing.T) {
10561083
So(db1, ShouldNotBeNil)
10571084
So(c1, ShouldNotBeNil)
10581085
So(err, ShouldBeNil)
1086+
defer os.Remove(f1)
10591087

10601088
e, err := userExists(db1, "admin")
10611089
So(err, ShouldBeNil)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /