Added some db unit tests

This commit is contained in:
Jamie Curnow
2023-07-26 13:29:12 +10:00
parent d555af68fe
commit e4e70ae6be
7 changed files with 198 additions and 55 deletions

View File

@ -37,6 +37,12 @@ func GetDB() *gorm.DB {
return dbInstance
}
// SetDB will set the dbOnstance to this
// Used by unit testing to set the db to a mock database
func SetDB(db *gorm.DB) {
dbInstance = db
}
func connect() (*gorm.DB, error) {
var d gorm.Dialector
dsn := config.Configuration.DB.GetGormConnectURL()