Cloudreve/models/migration_test.go

21 lines
379 B
Go
Raw Normal View History

2019-12-04 00:49:28 -05:00
package model
import (
"github.com/HFO4/cloudreve/pkg/conf"
2019-12-05 04:01:14 -05:00
"github.com/jinzhu/gorm"
2019-12-04 00:49:28 -05:00
"github.com/stretchr/testify/assert"
"testing"
)
func TestMigration(t *testing.T) {
asserts := assert.New(t)
conf.DatabaseConfig.Type = "sqlite3"
2019-12-05 04:01:14 -05:00
DB, _ = gorm.Open("sqlite3", ":memory:")
2019-12-04 00:49:28 -05:00
asserts.NotPanics(func() {
migration()
})
conf.DatabaseConfig.Type = "mysql"
2019-12-05 04:01:14 -05:00
DB = mockDB
2019-12-04 00:49:28 -05:00
}