Implemented goconvey for User Authentication Tests

Reference #580
This commit is contained in:
Gert-Jan Timmer 2018-06-01 17:59:42 +02:00
parent 90f966bed9
commit 11627e4483
6 changed files with 1089 additions and 181 deletions

View File

@ -88,6 +88,7 @@ before_install:
fi
- |
if [[ "${GOOS}" != "windows" ]]; then
go get github.com/smartystreets/goconvey
go get github.com/mattn/goveralls
go get golang.org/x/tools/cmd/cover
fi

View File

@ -1306,7 +1306,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
//
// If the SQLITE_USER table is not present in the database file, then
// this interface is a harmless no-op returnning SQLITE_OK.
if err := conn.RegisterFunc("authenticate", conn.authenticate, false); err != nil {
if err := conn.RegisterFunc("authenticate", conn.authenticate, true); err != nil {
return nil, err
}
//
@ -1319,7 +1319,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
// The AuthUserAdd only works for the "main" database, not
// for any ATTACH-ed databases. Any call to AuthUserAdd by a
// non-admin user results in an error.
if err := conn.RegisterFunc("auth_user_add", conn.authUserAdd, false); err != nil {
if err := conn.RegisterFunc("auth_user_add", conn.authUserAdd, true); err != nil {
return nil, err
}
//
@ -1329,7 +1329,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
// login credentials. Only an admin user can change another users login
// credentials or admin privilege setting. No user may change their own
// admin privilege setting.
if err := conn.RegisterFunc("auth_user_change", conn.authUserChange, false); err != nil {
if err := conn.RegisterFunc("auth_user_change", conn.authUserChange, true); err != nil {
return nil, err
}
//
@ -1339,13 +1339,13 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
// which guarantees that there is always an admin user and hence that
// the database cannot be converted into a no-authentication-required
// database.
if err := conn.RegisterFunc("auth_user_delete", conn.authUserDelete, false); err != nil {
if err := conn.RegisterFunc("auth_user_delete", conn.authUserDelete, true); err != nil {
return nil, err
}
// Register: auth_enabled
// auth_enabled can be used to check if user authentication is enabled
if err := conn.RegisterFunc("auth_enabled", conn.authEnabled, false); err != nil {
if err := conn.RegisterFunc("auth_enabled", conn.authEnabled, true); err != nil {
return nil, err
}

11
sqlite3.goconvey Normal file
View File

@ -0,0 +1,11 @@
// GoConvey Test Profile
// Activate Coverage
-cover
-run=TestUserAuthentication
// Test Flags
-tags=sqlite_userauth
// EOF

File diff suppressed because it is too large Load Diff

7
upgrade/package.go Normal file
View File

@ -0,0 +1,7 @@
// Package upgrade
//
// Dummy to ensure package can be loaded
//
// This file is to avoid the following error:
// can't load package: package go-sqlite3/upgrade: build constraints exclude all Go files in go-sqlite3\upgrade
package upgrade

2
upgrade/profile.goconvey Normal file
View File

@ -0,0 +1,2 @@
// Goconvey Profile
IGNORE