Cloudreve/models/migration_test.go

22 lines
388 B
Go
Raw Normal View History

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