Skip to content

Commit 11627e4

Browse files
committed
Implemented goconvey for User Authentication Tests
Reference #580
1 parent 90f966b commit 11627e4

File tree

6 files changed

+1066
-158
lines changed

6 files changed

+1066
-158
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ before_install:
8888
fi
8989
- |
9090
if [[ "${GOOS}" != "windows" ]]; then
91+
go get github.com/smartystreets/goconvey
9192
go get github.com/mattn/goveralls
9293
go get golang.org/x/tools/cmd/cover
9394
fi

sqlite3.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
13061306
//
13071307
// If the SQLITE_USER table is not present in the database file, then
13081308
// this interface is a harmless no-op returnning SQLITE_OK.
1309-
if err := conn.RegisterFunc("authenticate", conn.authenticate, false); err != nil {
1309+
if err := conn.RegisterFunc("authenticate", conn.authenticate, true); err != nil {
13101310
return nil, err
13111311
}
13121312
//
@@ -1319,7 +1319,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
13191319
// The AuthUserAdd only works for the "main" database, not
13201320
// for any ATTACH-ed databases. Any call to AuthUserAdd by a
13211321
// non-admin user results in an error.
1322-
if err := conn.RegisterFunc("auth_user_add", conn.authUserAdd, false); err != nil {
1322+
if err := conn.RegisterFunc("auth_user_add", conn.authUserAdd, true); err != nil {
13231323
return nil, err
13241324
}
13251325
//
@@ -1329,7 +1329,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
13291329
// login credentials. Only an admin user can change another users login
13301330
// credentials or admin privilege setting. No user may change their own
13311331
// admin privilege setting.
1332-
if err := conn.RegisterFunc("auth_user_change", conn.authUserChange, false); err != nil {
1332+
if err := conn.RegisterFunc("auth_user_change", conn.authUserChange, true); err != nil {
13331333
return nil, err
13341334
}
13351335
//
@@ -1339,13 +1339,13 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
13391339
// which guarantees that there is always an admin user and hence that
13401340
// the database cannot be converted into a no-authentication-required
13411341
// database.
1342-
if err := conn.RegisterFunc("auth_user_delete", conn.authUserDelete, false); err != nil {
1342+
if err := conn.RegisterFunc("auth_user_delete", conn.authUserDelete, true); err != nil {
13431343
return nil, err
13441344
}
13451345

13461346
// Register: auth_enabled
13471347
// auth_enabled can be used to check if user authentication is enabled
1348-
if err := conn.RegisterFunc("auth_enabled", conn.authEnabled, false); err != nil {
1348+
if err := conn.RegisterFunc("auth_enabled", conn.authEnabled, true); err != nil {
13491349
return nil, err
13501350
}
13511351

sqlite3.goconvey

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// GoConvey Test Profile
2+
3+
// Activate Coverage
4+
-cover
5+
6+
-run=TestUserAuthentication
7+
8+
// Test Flags
9+
-tags=sqlite_userauth
10+
11+
// EOF

0 commit comments

Comments
 (0)