mirror of
https://gitee.com/goploy/goploy.git
synced 2024-12-02 04:07:33 +08:00
26 lines
465 B
Go
26 lines
465 B
Go
package model
|
|
|
|
import (
|
|
"github.com/zhenorzz/goploy/config"
|
|
"github.com/zhenorzz/goploy/database"
|
|
"testing"
|
|
)
|
|
|
|
func TestInitDB(t *testing.T) {
|
|
config.Init()
|
|
db, err := Open(config.Toml.DB)
|
|
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := db.CreateDB(config.Toml.DB.Database); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := db.UseDB(config.Toml.DB.Database); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := db.ImportSQL(database.GoploySQL); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|