Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/db/gorm_test.go
Atvaark 0678d19097 Add template and db tests (#291)
- The db test will run an sqlite3 database in in-memory
  mode and run the automigrations.
- The template test will check if all the templates
  that are stored in package variables (template.Must)
  compile and if ReloadTemplates works without panicking.
2017-05-10 18:15:36 -05:00

25 lignes
401 o
Go

package db
import (
"testing"
"github.com/ewhal/nyaa/config"
)
func TestGormInit(t *testing.T) {
conf := config.New()
conf.DBType = "sqlite3"
conf.DBParams = ":memory:?cache=shared&mode=memory"
db, err := GormInit(conf)
if err != nil {
t.Errorf("failed to initialize database: %v", err)
return
}
err = db.Close()
if err != nil {
t.Errorf("failed to close database: %v", err)
}
}